Inheritance: extends Kraken\Util\Factory\Factory, implements FilesystemAdapterFactoryInterface
コード例 #1
0
 /**
  * @return ConfigFactory
  */
 public function createConfigFactory()
 {
     if (ini_get('allow_url_include') !== '1') {
         return;
     }
     $path = __DIR__ . '/_Data';
     $factory = new FilesystemAdapterFactory();
     $fs = new Filesystem($factory->create('Local', [['path' => $path]]));
     $parsers = ['json' => new JsonParser()];
     return new ConfigFactory($fs, [], $parsers, true);
 }
コード例 #2
0
 /**
  * @param ContainerInterface $container
  */
 protected function register(ContainerInterface $container)
 {
     $core = $container->make('Kraken\\Core\\CoreInterface');
     $config = $container->make('Kraken\\Config\\ConfigInterface');
     $factory = new FilesystemAdapterFactory();
     $fsCloud = new FilesystemManager();
     $fsDisk = new Filesystem($factory->create('Local', [['path' => $core->getBasePath()]]));
     $disks = $config->get('filesystem.cloud');
     foreach ($disks as $disk => $config) {
         $fsCloud->mountFilesystem($disk, new Filesystem($factory->create($config['class'], [$config['config']])));
     }
     $container->instance('Kraken\\Filesystem\\FilesystemInterface', $fsDisk);
     $container->instance('Kraken\\Filesystem\\FilesystemFactoryInterface', new FilesystemFactory());
     $container->instance('Kraken\\Filesystem\\FilesystemManagerInterface', $fsCloud);
 }
コード例 #3
0
 /**
  * @param string $path
  * @return ConfigInterface
  */
 private function createConfig($path)
 {
     $factory = new FilesystemAdapterFactory();
     $path = explode('/', $path);
     $file = array_pop($path);
     $path = implode('/', $path);
     return (new ConfigFactory(new Filesystem($factory->create('Local', [['path' => $path]])), ['#' . $file . '#si']))->create();
 }
コード例 #4
0
 /**
  * @return FilesystemInterface
  */
 public function createFilesystem($path = null)
 {
     $factory = new FilesystemAdapterFactory();
     return new Filesystem($factory->create('Local', [['path' => $path !== null ? $path : $this->path]]));
 }