• File: BackblazeFilesystem.php
  • Full Path: /var/www/crm_set/modules/backup/vendor/backup-manager/backup-manager/src/Filesystems/BackblazeFilesystem.php
  • Date Modified: 09/21/2026 4:20 AM
  • File size: 835 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php namespace BackupManager\Filesystems;

use BackblazeB2\Client;
use League\Flysystem\Filesystem as Flysystem;
use Mhetreramesh\Flysystem\BackblazeAdapter;

/**
 * Class BackblazeFilesystem
 * @package BackupManager\Filesystems
 */
class BackblazeFilesystem implements Filesystem {

    /**
     * Test fitness of visitor.
     * @param $type
     * @return bool
     */
    public function handles($type) {
        return strtolower($type) == 'b2';
    }

    /**
     * @param array $config
     * @return Flysystem
     */
    public function get(array $config) {
        if (!isset($config['options'])) {
            $config['options'] = [];
        }

        $client = new Client($config['accountId'], $config['key'], $config['options']);
        return new Flysystem(new BackblazeAdapter($client, $config['bucket']));
    }
}