예제 #1
0
 /**
  * @return Filesystem
  */
 public function getFilesystem()
 {
     if ($this->filesystem == null) {
         $this->filesystem = new Filesystem(new Local($this->path));
         $this->filesystem->addPlugin(new ListFiles());
     }
     return $this->filesystem;
 }
 public function boot()
 {
     Storage::extend('qiniu', function ($app, $config) {
         $client = new QiniuAdapter($config['accessKey'], $config['secretKey'], $config['bucket'], $config['domain'], $config['notify_url'], $config['pipeline']);
         $filesystem = new Filesystem($client);
         $filesystem->addPlugin(new UploadToken());
         $filesystem->addPlugin(new PersistentStatus());
         $filesystem->addPlugin(new PersistentFop());
         $filesystem->addPlugin(new PrivateDownloadUrl());
         $filesystem->addPlugin(new VerifyCallback());
         return $filesystem;
     });
 }
 public function boot()
 {
     Storage::extend('oss', function ($app, $config) {
         $ossconfig = ['AccessKeyId' => $config['access_id'], 'AccessKeySecret' => $config['access_key']];
         if (isset($config['endpoint']) && !empty($config['endpoint'])) {
             $ossconfig['Endpoint'] = $config['endpoint'];
         }
         $client = new \ALIOSS($ossconfig['AccessKeyId'], $ossconfig['AccessKeySecret'], $ossconfig['Endpoint']);
         $filesystem = new Filesystem(new AliyunOssAdapter($client, $config['bucket'], $config['prefix']));
         $filesystem->addPlugin(new initMultiUpload());
         $filesystem->addPlugin(new mergeMultiInfo());
         $filesystem->addPlugin(new uploadMultiPart());
         $filesystem->addPlugin(new finishMultiUpload());
         return $filesystem;
     });
 }
 /**
  * @param array $settings
  * @param \League\Flysystem\AdapterInterface $adapter
  */
 public function __construct(array $settings, AdapterInterface $adapter = null)
 {
     $adapter = $adapter ?: $this->createAdapter($settings);
     $filesystem = new Filesystem($adapter, $settings);
     $filesystem->addPlugin(new ListFiles());
     $this->filesystem = $filesystem;
 }
 public function boot()
 {
     Storage::extend('bos', function ($app, $config) {
         $client = new BosClient($config['options']);
         $filesystem = new Filesystem(new BaiduBosAdapter($client, $config['bucket']));
         $filesystem->addPlugin(new PutFilePlugin());
         return $filesystem;
     });
 }
 public function boot()
 {
     \Storage::extend('qiniu', function ($app, $config) {
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $config['domain']);
         $file_system = new Filesystem($qiniu_adapter);
         $file_system->addPlugin(new PrivateDownloadUrl());
         $file_system->addPlugin(new DownloadUrl());
         $file_system->addPlugin(new ImageInfo());
         $file_system->addPlugin(new ImageExif());
         $file_system->addPlugin(new ImagePreviewUrl());
         $file_system->addPlugin(new PersistentFop());
         $file_system->addPlugin(new PersistentStatus());
         $file_system->addPlugin(new UploadToken());
         $file_system->addPlugin(new Fetch());
         $file_system->addPlugin(new PutFile());
         return $file_system;
     });
 }
예제 #7
0
 /**
  * @inheritdoc
  */
 protected function init()
 {
     $this->fs = $this->options['filesystem'];
     if (!$this->fs instanceof FilesystemInterface && !$this->fs instanceof \creocoder\flysystem\Filesystem) {
         return $this->setError('A filesystem instance is required');
     }
     $this->fs->addPlugin(new UrlPlugin());
     isset($this->options['icon']) ?: ($this->options['icon'] = $this->getIcon());
     $this->root = $this->options['path'];
     if ($this->options['glideURL']) {
         $this->urlBuilder = UrlBuilderFactory::create($this->options['glideURL'], $this->options['glideKey']);
     }
     if ($this->options['imageManager']) {
         $this->imageManager = $this->options['imageManager'];
     } else {
         $this->imageManager = new ImageManager();
     }
     return true;
 }
 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     Storage::extend('oss', function ($app, $config) {
         $accessId = $config['access_id'];
         $accessKey = $config['access_key'];
         $endPoint = $config['endpoint'];
         $bucket = $config['bucket'];
         $prefix = null;
         if (isset($config['prefix'])) {
             $prefix = $config['prefix'];
         }
         $client = new OssClient($accessId, $accessKey, $endPoint);
         $adapter = new AliyunOssAdapter($client, $bucket, $prefix);
         $filesystem = new Filesystem($adapter);
         $filesystem->addPlugin(new PutFile());
         $filesystem->addPlugin(new SignedDownloadUrl());
         return $filesystem;
     });
 }
 public function boot()
 {
     class_alias('Illuminate\\Support\\Facades\\Storage', 'Storage');
     //for Lumen5.2
     \Storage::extend('qiniu', function ($app, $config) {
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $config['domain'], $config['pipeline'], $config['notify_url']);
         $file_system = new Filesystem($qiniu_adapter);
         $file_system->addPlugin(new PrivateDownloadUrl());
         $file_system->addPlugin(new DownloadUrl());
         $file_system->addPlugin(new ImageInfo());
         $file_system->addPlugin(new ImageExif());
         $file_system->addPlugin(new ImagePreviewUrl());
         $file_system->addPlugin(new PersistentFop());
         $file_system->addPlugin(new PersistentStatus());
         $file_system->addPlugin(new UploadToken());
         $file_system->addPlugin(new PutFile());
         $file_system->addPlugin(new Put());
         return $file_system;
     });
 }
 public function boot()
 {
     Storage::extend('qiniu', function ($app, $config) {
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['buckets'], $config['notify_url'] ? $config['notify_url'] : null);
         $file_system = new Filesystem($qiniu_adapter);
         $plugins = [PrivateDownloadUrl::class, DownloadUrl::class, ImageExif::class, ImageInfo::class, ImagePreviewUrl::class, PersistentFop::class, PersistentStatus::class, WithBucket::class, ToBucket::class, UploadToken::class];
         foreach ($plugins as $plugin) {
             $file_system->addPlugin(new $plugin());
         }
         return $file_system;
     });
 }
예제 #11
0
 public function __construct(AdapterInterface $local, AdapterInterface $remote)
 {
     // Remember the local root path
     $this->localRootPath = $local->getPathPrefix();
     // Create the local filesystem
     $local = new Filesystem($local);
     $local->addPlugin(new ListWith());
     $this->localFilesystem = $local;
     // The remote filesystem
     $remote = new Filesystem($remote);
     // Create the manager with the local and remote filesystems
     $this->manager = new MountManager(compact('local', 'remote'));
 }
 public function setUp()
 {
     parent::setUp();
     // Set backend
     $adapter = new AssetAdapter(ASSETS_PATH . '/DBFileTest');
     $filesystem = new Filesystem($adapter);
     $filesystem->addPlugin(new FlysystemUrlPlugin());
     $backend = new AssetStoreTest_SpyStore();
     $backend->setFilesystem($filesystem);
     Injector::inst()->registerService($backend, 'AssetStore');
     // Disable legacy
     Config::inst()->remove(get_class(new FlysystemAssetStore()), 'legacy_filenames');
     // Update base url
     Config::inst()->update('Director', 'alternate_base_url', '/mysite/');
 }
 public function __construct($name = null, array $data = [], $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     /*
      * TODO 测试依赖
      */
     $accessId = 'you access id';
     $accessKey = 'you access key';
     $endPoint = 'oss-cn-beijing.aliyuncs.com';
     $bucket = 'you bucket';
     $client = new OssClient($accessId, $accessKey, $endPoint);
     $adapter = new AliyunOssAdapter($client, $bucket);
     $adapter->deleteDir('test');
     $adapter->setPathPrefix('test');
     $filesystem = new Filesystem($adapter);
     $filesystem->addPlugin(new PutFile());
     $this->filesystem = $filesystem;
 }
 public function boot()
 {
     \Storage::extend('qiniu', function ($app, $config) {
         if (isset($config['domains'])) {
             $domains = $config['domains'];
         } else {
             $domains = ['default' => $config['domain'], 'https' => null, 'custom' => null];
         }
         $qiniu_adapter = new QiniuAdapter($config['access_key'], $config['secret_key'], $config['bucket'], $domains, $config['notify_url']);
         $file_system = new Filesystem($qiniu_adapter);
         $file_system->addPlugin(new PrivateDownloadUrl());
         $file_system->addPlugin(new DownloadUrl());
         $file_system->addPlugin(new ImageInfo());
         $file_system->addPlugin(new ImageExif());
         $file_system->addPlugin(new ImagePreviewUrl());
         $file_system->addPlugin(new PersistentFop());
         $file_system->addPlugin(new PersistentStatus());
         $file_system->addPlugin(new UploadToken());
         return $file_system;
     });
 }
function getResources($uploads_dir, $id, $maxWidth, $connection = 'default')
{
    $attachments = Attachment::on($connection)->where('id', $id)->get();
    if (count($attachments) == 1) {
        $attachment = $attachments[0];
        switch ($attachment->source) {
            case Source::EMAIL:
                $adapter = new Local($uploads_dir . '/email/');
                break;
            case Source::TWITTER:
                $adapter = new Local($uploads_dir . '/twitter/');
                break;
            case Source::TELEGRAM:
                $adapter = new Local($uploads_dir . '/telegram/');
                break;
            default:
                break;
        }
        $filesystem = new Filesystem($adapter);
        $filesystem->addPlugin(new ListWith());
        if ($filesystem->has($attachment->filePath)) {
            $data = $filesystem->read($attachment->filePath);
            $fp['data'] = $data;
            $fp['mime'] = $filesystem->getMimetype($attachment->filePath);
            if ($maxWidth > 0) {
                $imagine = new \Imagine\Gd\Imagine();
                $image = $imagine->load($data);
                $size = $image->getSize();
                if ($size->getWidth() > $maxWidth) {
                    // AWIDTH : AHEIGHT = NWIDTH : NHEIGHT
                    // HHEIGHT = AHEIGHT * NWIDTH / AWIDTH
                    $height = $size->getHeight() * $maxWidth / $size->getWidth();
                    $width = $maxWidth;
                    $fp['data'] = $image->resize(new Box($width, $height), ImageInterface::FILTER_UNDEFINED)->show('png');
                    //FILTER_QUADRATIC
                }
            }
            return $fp;
        }
    }
    return false;
}
예제 #16
0
 /**
  * Get flysystem object
  *
  * @return League\Flysystem\Filesystem
  */
 protected function _getFilesystem()
 {
     if (!$this->_filesystem) {
         try {
             if (Mage::app()->useCache('file_storage') && ($cache = $this->_getCache()) && !$this->getNoCache()) {
                 $adapter = new CachedAdapter($this->_getAdapter(), $cache);
             } else {
                 $cacheStore = new CacheStore();
                 $adapter = new CachedAdapter($this->_getAdapter(), $cacheStore);
             }
         } catch (Exception $e) {
             // catch adapter errors and default to using local adapter with media directory
             Mage::logException($e);
             $this->_adapter = new \League\Flysystem\Adapter\Local(Mage::getBaseDir('media'));
             $adapter = $this->_adapter;
         }
         $this->_filesystem = new Filesystem($adapter);
         $this->_filesystem->addPlugin(new League\Flysystem\Plugin\GetWithMetadata());
     }
     return $this->_filesystem;
 }
 /**
  * @return int
  */
 public function pruneStorage()
 {
     if (!$this->options->getPruneMaxCount() && !$this->options->getPruneMaxTtl()) {
         return 0;
     }
     // save to just add
     $this->filesystem->addPlugin(new ListFiles());
     $filesInBackup = $this->filesystem->listFiles($this->options->getPath());
     // filter latest.txt
     if ($this->options->getWriteLatest()) {
         $filesInBackup = array_filter($filesInBackup, function ($item) {
             return $item['basename'] != $this->options->getWriteLatest();
         });
     }
     // sort on timestamp
     usort($filesInBackup, function ($item1, $item2) {
         return strcmp($item1['timestamp'], $item2['timestamp']);
     });
     $pruneCount = 0;
     // remove while count >= pruneMaxCount or timestamp < now - pruneMaxTtl
     while ($last = array_shift($filesInBackup)) {
         if ($this->options->getPruneMaxCount()) {
             if (count($filesInBackup) >= $this->options->getPruneMaxCount()) {
                 $this->filesystem->delete($last['path']);
                 $pruneCount++;
                 continue;
             }
         }
         if ($this->options->getPruneMaxTtl()) {
             if ($last['timestamp'] < time() - $this->options->getPruneMaxTtl()) {
                 $this->filesystem->delete($last['path']);
                 $pruneCount++;
                 continue;
             }
         }
     }
     return $pruneCount;
 }
예제 #18
0
 /**
  * {@inheritdoc}
  */
 public function open($name)
 {
     $tempFileName = $this->temporaryFileSystem->createTemporaryFile();
     $stream = $this->localFilesystem->readStream(sprintf('%s/%s.zip', $this->name, $name));
     file_put_contents($tempFileName, $stream);
     $filesystem = new Filesystem(new ReadonlyAdapter(new ZipArchiveAdapter($tempFileName)));
     $filesystem->addPlugin(new ListFiles());
     return $filesystem;
 }
 protected function getFs(XxamFilesystem $filesystem)
 {
     $settings = json_decode($filesystem->getSettings(), true);
     $adapter = false;
     switch ($filesystem->getAdapter()) {
         case 'local':
             $adapter = $this->createLocalAdapter($settings);
             break;
         case 'dropbox':
             $adapter = $this->createDropboxAdapter($settings);
             break;
         case 'ftp':
             $adapter = $this->createFtpAdapter($settings);
             break;
         case 'sftp':
             $adapter = $this->createSftpAdapter($settings);
             break;
     }
     if (!$adapter) {
         return false;
     }
     if (!empty($settings['cache']) && $settings['cache']) {
         $memcached = $this->get('memcached');
         $cadapter = new CachedAdapter($adapter, new Cache($memcached, 'xxam_filemanager_' . $filesystem->getId(), 300));
         $fs = new Filesystem($cadapter);
     } else {
         $fs = new Filesystem($adapter);
     }
     switch ($filesystem->getAdapter()) {
         case 'local':
             $fs->addPlugin(new ThumbnailLocal($this->get('just_thumbnail')));
             break;
         case 'dropbox':
             $fs->addPlugin(new ThumbnailDropbox());
             break;
     }
     //$fs->addPlugin(new ListWith);
     return $fs;
 }
 /**
  * Set this store as the new asset backend
  *
  * @param string $basedir Basedir to store assets, which will be placed beneath 'assets' folder
  */
 public static function activate($basedir)
 {
     // Assign this as the new store
     $adapter = new AssetAdapter(ASSETS_PATH . '/' . $basedir);
     $filesystem = new Filesystem($adapter);
     $filesystem->addPlugin(new FlysystemUrlPlugin());
     $backend = new AssetStoreTest_SpyStore();
     $backend->setFilesystem($filesystem);
     Injector::inst()->registerService($backend, 'AssetStore');
     // Disable legacy and set defaults
     Config::inst()->remove(get_class(new FlysystemAssetStore()), 'legacy_filenames');
     Config::inst()->update('Director', 'alternate_base_url', '/');
     DBFile::config()->force_resample = false;
     File::config()->force_resample = false;
     self::reset();
     self::$basedir = $basedir;
     // Ensure basedir exists
     SS_Filesystem::makeFolder(self::base_path());
 }
예제 #21
0
	/**
	 * Initialize the storage backend with a flyssytem adapter
	 *
	 * @param \League\Flysystem\AdapterInterface $adapter
	 */
	protected function buildFlySystem(AdapterInterface $adapter) {
		$this->flysystem = new Filesystem($adapter);
		$this->flysystem->addPlugin(new GetWithMetadata());
	}
예제 #22
0
$container['flysystem.dbafs.plugins'] = $container->share(function () {
    $plugins = new \ArrayObject();
    $plugins[] = new Plugin\GetWithMetadata();
    $plugins[] = new Plugin\ListFiles();
    $plugins[] = new Plugin\ListPaths();
    $plugins[] = new Plugin\ListWith();
    $plugins[] = new Plugin\EmptyDir();
    return $plugins;
});
/*
 * Dbafs file system.
 */
$container['flysystem.dbafs.file-system'] = $container->share(function ($container) {
    $fileSystem = new Filesystem($container['flysystem.dbafs.adapter']);
    foreach ($container['flysystem.dbafs.plugins'] as $plugin) {
        $fileSystem->addPlugin($plugin);
    }
    return $fileSystem;
});
/**
 * Flysystem integration.
 */
/*
 * File systems registry. Add your filesystem to $container['flysystem.file-systems'].
 */
$container['flysystem.file-systems'] = $container->share(function ($container) {
    $fileSystems = new \ArrayObject();
    $fileSystems['local'] = $container['flysystem.local.file-system'];
    $fileSystems['dbafs'] = $container['flysystem.dbafs.file-system'];
    return $fileSystems;
});
use League\Flysystem\Filesystem;
use League\Flysystem\Plugin\ListWith;
function parseTweet($ret)
{
    $ret = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
    $ret = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
    $ret = preg_replace("/@(\\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $ret);
    // Usernames
    $ret = preg_replace("/#(\\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $ret);
    // Hash Tags
    return $ret;
}
try {
    $adapter = new Local($config['uploads_dir'] . '/twitter/');
    $filesystem = new Filesystem($adapter);
    $filesystem->addPlugin(new ListWith());
    $capsule = new Capsule();
    foreach ($config['databases'] as $name => $database) {
        $capsule->addConnection($database, $name);
    }
    $capsule->setAsGlobal();
    $capsule->bootEloquent();
    $connection = new TwitterOAuth($config['twitter_consumer_key'], $config['twitter_consumer_secret'], $config['twitter_access_token'], $config['twitter_access_secret']);
    $connection->setTimeouts(10, 15);
    if ($filesystem->has('last.tweet')) {
        $lastId = $filesystem->read('last.tweet');
        $content_search = $connection->get("search/tweets", array("q" => $config['twitter_hashtag_search'], "result_type" => "recent", "count" => "10", "since_id" => "{$lastId}"));
    } else {
        $content_search = $connection->get("search/tweets", array("q" => $config['twitter_hashtag_search'], "result_type" => "recent", "count" => "10"));
    }
    foreach ($content_search->statuses as $elem_search) {
 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @param                         $name
  * @param                         $requestedName
  * @return FilesystemInterface
  */
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     $serviceLocator = $serviceLocator->getServiceLocator();
     $config = $serviceLocator->get('config');
     $fsConfig = $config['bsb_flysystem']['filesystems'][$requestedName];
     if (!isset($fsConfig['adapter'])) {
         throw new UnexpectedValueException(sprintf("Missing 'adapter' key for the filesystem '%s' configuration", $name));
     }
     $adapter = $serviceLocator->get('BsbFlysystemAdapterManager')->get($fsConfig['adapter'], $this->options['adapter_options']);
     $options = isset($fsConfig['options']) && is_array($fsConfig['options']) ? $fsConfig['options'] : [];
     if (isset($fsConfig['cache']) && is_string($fsConfig['cache'])) {
         if (!class_exists('League\\Flysystem\\Cached\\CachedAdapter')) {
             throw new RequirementsException(['league/flysystem-cached-adapter'], 'CachedAdapter');
         }
         $cacheAdapter = $serviceLocator->get($fsConfig['cache']);
         // wrap if StorageInterface, use filesystem name a key
         if ($cacheAdapter instanceof StorageInterface) {
             $cacheAdapter = new ZendStorageCache($cacheAdapter, $requestedName);
         }
         // ignore if not CacheInterface
         if ($cacheAdapter instanceof CacheInterface) {
             $adapter = new CachedAdapter($adapter, $cacheAdapter);
         }
     }
     if (isset($fsConfig['eventable']) && filter_var($fsConfig['eventable'], FILTER_VALIDATE_BOOLEAN)) {
         if (!class_exists('League\\Flysystem\\EventableFilesystem\\EventableFilesystem')) {
             throw new RequirementsException(['league/flysystem-eventable-filesystem'], 'EventableFilesystem');
         }
         $filesystem = new EventableFilesystem($adapter, $options);
     } else {
         $filesystem = new Filesystem($adapter, $options);
     }
     if (isset($fsConfig['plugins']) && is_array($fsConfig['plugins'])) {
         foreach ($fsConfig['plugins'] as $plugin) {
             $plugin = new $plugin();
             $filesystem->addPlugin($plugin);
         }
     }
     return $filesystem;
 }
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use League\Flysystem\Filesystem;
use League\Flysystem\Memory\MemoryAdapter as Adapter;
use Flyfinder\Finder;
use Flyfinder\Path;
use Flyfinder\Specification\IsHidden;
use Flyfinder\Specification\HasExtension;
use Flyfinder\Specification\InPath;
/*
 * First create a new Filesystem and add the FlySystem plugin
 * In this example we are using a filesystem with the memory adapter
 */
$filesystem = new Filesystem(new Adapter());
$filesystem->addPlugin(new Finder());
// Create some demo files
$filesystem->write('test.txt', 'test');
$filesystem->write('.hiddendir/.test.txt', 'test');
$filesystem->write('.hiddendir/found.txt', 'test');
$filesystem->write('.hiddendir/normaldir/example.txt', 'test');
/*
 * In order to tell FlyFinder what to find, you need to give it a specification
 * In this example the specification will be satisfied by *.txt files
 * within the .hidden directory and its subdirectories that are not hidden
 */
$isHidden = new IsHidden();
$hasExtension = new HasExtension(['txt']);
$inPath = new InPath(new Path('.hiddendir'));
$specification = $inPath->andSpecification($hasExtension)->andSpecification($isHidden->notSpecification());
//FlyFinder will yield a generator object with the files that are found
예제 #26
0
파일: Nanbando.php 프로젝트: nanbando/core
 /**
  * Restore process.
  *
  * @param string $name
  */
 public function restore($name)
 {
     $source = $this->storage->open($name);
     $destination = new Filesystem(new Local(realpath('.'), LOCK_EX, null));
     $destination->addPlugin(new ListFiles());
     $destination->addPlugin(new HashPlugin());
     $systemData = json_decode($source->read('database/system.json'), true);
     $systemDatabase = $this->databaseFactory->createReadonly($systemData);
     $event = new PreRestoreEvent($this->backup, $systemDatabase, $source, $destination);
     $this->eventDispatcher->dispatch(Events::PRE_RESTORE_EVENT, $event);
     if ($event->isCanceled()) {
         return;
     }
     $backupConfig = $event->getBackup();
     foreach ($backupConfig as $backupName => $backup) {
         $backupSource = new Filesystem(new PrefixAdapter('backup/' . $backupName, $source->getAdapter()));
         $backupSource->addPlugin(new ListFiles());
         $backupSource->addPlugin(new HashPlugin());
         $data = json_decode($source->read(sprintf('database/backup/%s.json', $backupName)), true);
         $database = $this->databaseFactory->createReadonly($data);
         $event = new RestoreEvent($systemDatabase, $database, $backupSource, $destination, $backupName, $backup);
         $this->eventDispatcher->dispatch(Events::RESTORE_EVENT, $event);
     }
     $this->eventDispatcher->dispatch(Events::POST_RESTORE_EVENT, new Event());
 }
예제 #27
0
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use League\Flysystem\Plugin\ListFiles;
use Lighwand\Validate\Loader\EventLoader;
use Lighwand\Validate\Loader\SpeakerLoader;
use Lighwand\Validate\Loader\VideoLoader;
use Lighwand\Validate\Video\Event\EventExists;
use Lighwand\Validate\Video\Id\IdMatchesFileName;
use Lighwand\Validate\Video\Speaker\SpeakersExist;
use Zend\ServiceManager\ServiceLocatorInterface;
return ['validators' => ['video' => ['id' => [IdMatchesFileName::class], 'name' => [], 'event' => [EventExists::class], 'speakers' => [SpeakersExist::class], 'tags' => ['required' => false], 'recorded_at' => [], 'uploaded_at' => [], 'duration' => [], 'poster' => ['required' => false]]], 'services' => ['factories' => ['Config' => function () {
    /** @noinspection PhpIncludeInspection */
    return include __FILE__;
}, Filesystem::class => function () {
    $fs = new Filesystem(new Local(dirname(__DIR__)));
    $fs->addPlugin(new ListFiles());
    return $fs;
}, VideoLoader::class => function (ServiceLocatorInterface $sl) {
    /** @var Filesystem $filesystem */
    $filesystem = $sl->get(Filesystem::class);
    return new VideoLoader($filesystem);
}, SpeakersExist::class => function (ServiceLocatorInterface $sl) {
    /** @var SpeakerLoader $speakerLoader */
    $speakerLoader = $sl->get(SpeakerLoader::class);
    return new SpeakersExist($speakerLoader);
}, SpeakerLoader::class => function (ServiceLocatorInterface $sl) {
    /** @var Filesystem $filesystem */
    $filesystem = $sl->get(Filesystem::class);
    return new SpeakerLoader($filesystem);
}, EventExists::class => function (ServiceLocatorInterface $sl) {
    /** @var EventLoader $eventLoader */