当前位置: 首页>>代码示例>>PHP>>正文


PHP FilesystemManager::__construct方法代码示例

本文整理汇总了PHP中Illuminate\Filesystem\FilesystemManager::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemManager::__construct方法的具体用法?PHP FilesystemManager::__construct怎么用?PHP FilesystemManager::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Filesystem\FilesystemManager的用法示例。


在下文中一共展示了FilesystemManager::__construct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($app)
 {
     parent::__construct($app);
     if (class_exists('\\League\\Flysystem\\Azure\\AzureAdapter')) {
         $this->extend('azure', function ($app, $config) {
             $endpoint = sprintf('DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', $config['accountName'], $config['apiKey']);
             $client = \WindowsAzure\Common\ServicesBuilder::getInstance()->createBlobService($endpoint);
             return $this->createFlysystem(new \League\Flysystem\Azure\AzureAdapter($client, $config['container']), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Copy\\CopyAdapter')) {
         $this->extend('copy', function ($app, $config) {
             $client = new \Barracuda\Copy\API($config['consumerKey'], $config['consumerSecret'], $config['accessToken'], $config['tokenSecret']);
             return $this->createFlysystem(new \League\Flysystem\Copy\CopyAdapter($client), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Dropbox\\DropboxAdapter')) {
         $this->extend('dropbox', function ($app, $config) {
             $client = new \Dropbox\Client($config['accessToken'], $config['clientIdentifier']);
             return $this->createFlysystem(new \League\Flysystem\Dropbox\DropboxAdapter($client), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\GridFS\\GridFSAdapter')) {
         $this->extend('gridfs', function ($app, $config) {
             $mongoClient = new \MongoClient($config['server'], Arr::except($config, ['driver', 'server', 'context', 'dbName']), Arr::get($config, 'context', null));
             $gridFs = $mongoClient->selectDB($config['dbName'])->getGridFS();
             return $this->createFlysystem(new \League\Flysystem\GridFS\GridFSAdapter($gridFs), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Memory\\MemoryAdapter')) {
         $this->extend('memory', function ($app, $config) {
             return $this->createFlysystem(new \League\Flysystem\Memory\MemoryAdapter(), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Phpcr\\PhpcrAdapter')) {
         $this->extend('phpcr', function ($app, $config) {
             $credentials = new \PHPCR\SimpleCredentials(null, null);
             $logger = new \Jackalope\Transport\LoggingPsr3Logger(Log::getMonolog());
             if (class_exists('\\Jackalope\\RepositoryFactoryJackrabbit')) {
                 $repository = (new \Jackalope\RepositoryFactoryJackrabbit())->getRepository(["jackalope.jackrabbit_uri" => $config['jackrabbit_url'], 'jackalope.logger' => $logger]);
                 $credentials = new \PHPCR\SimpleCredentials($config['user'], $config['pass']);
             } elseif (class_exists('Jackalope\\RepositoryFactoryDoctrineDBAL')) {
                 $repository = (new \Jackalope\RepositoryFactoryDoctrineDBAL())->getRepository(['jackalope.doctrine_dbal_connection' => \Doctrine\DBAL\DriverManager::getConnection(['pdo' => DB::connection(Arr::get($config, 'database'))->getPdo()]), 'jackalope.logger' => $logger]);
             } elseif (class_exists('\\Jackalope\\RepositoryFactoryPrismic')) {
                 $repository = (new \Jackalope\RepositoryFactoryPrismic())->getRepository(['jackalope.prismic_uri' => $config['prismic_uri'], 'jackalope.logger' => $logger]);
             } else {
                 throw new \League\Flysystem\NotSupportedException("Couldn't find supported PHPCR Repository implementation.  Install and configure one of Jackalope's JackRabbit, Doctrine DBAL, or Prismic.io implementations and try again.");
             }
             $session = $repository->login($credentials, $config['workspace']);
             return $this->createFlysystem(new \League\Flysystem\Phpcr\PhpcrAdapter($session, $config['root']), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Replicate\\ReplicateAdapter')) {
         $this->extend('replicate', function ($app, $config) {
             return $this->createFlysystem(new \League\Flysystem\Replicate\ReplicateAdapter($this->disk($config['master'])->getAdapter(), $this->disk($config['replica'])->getAdapter()), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Sftp\\SftpAdapter')) {
         $this->extend('sftp', function ($app, $config) {
             return $this->createFlysystem(new \League\Flysystem\Sftp\SftpAdapter($config), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\Vfs\\VfsAdapter')) {
         $this->extend('vfs', function ($app, $config) {
             return $this->createFlysystem(new \League\Flysystem\Vfs\VfsAdapter(new VirtualFileSystem\FileSystem()), $config);
         });
     }
     if (class_exists('\\League\\Flysystem\\WebDAV\\WebDAVAdapter')) {
         $this->extend('webdav', function ($app, $config) {
             if (!empty($config['authType'])) {
                 if (is_string($config['authType']) && strtolower($config['authType']) == 'ntlm') {
                     $config['authType'] = \Sabre\DAV\Client::AUTH_NTLM;
                 } elseif (is_string($config['authType']) && strtolower($config['authType']) == 'digest') {
                     $config['authType'] = \Sabre\DAV\Client::AUTH_DIGEST;
                 } else {
                     $config['authType'] = \Sabre\DAV\Client::AUTH_BASIC;
                 }
             }
             if (!empty($config['encoding'])) {
                 if (is_string($config['encoding']) && strtolower($config['encoding']) == 'all') {
                     $config['encoding'] = \Sabre\DAV\Client::ENCODING_ALL;
                 } else {
                     if (is_string($config['encoding'])) {
                         $encList = explode(',', $config['encoding']);
                     } elseif (is_array($config['encoding'])) {
                         $encList = $config['encoding'];
                     } elseif (!is_numeric($config['encoding'])) {
                         $encList = (array) $config['encoding'];
                     }
                     if (isset($encList)) {
                         $config['encoding'] = 0;
                         foreach ($encList as $encoding) {
                             switch ($encoding) {
                                 case 'deflate':
                                     $config['encoding'] &= \Sabre\DAV\Client::ENCODING_DEFLATE;
                                     break;
                                 case 'gzip':
//.........这里部分代码省略.........
开发者ID:danhunsaker,项目名称:laravel-flysystem-service,代码行数:101,代码来源:FlysystemManager.php

示例2: __construct

 public function __construct(\Illuminate\Contracts\Foundation\Application $app)
 {
     parent::__construct($app);
 }
开发者ID:garrinar,项目名称:laravel,代码行数:4,代码来源:Manager.php


注:本文中的Illuminate\Filesystem\FilesystemManager::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。