Inheritance: extends Kraken\Util\Factory\Factory, implements FilesystemAdapterFactoryInterface
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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();
 }
Exemplo n.º 4
0
 /**
  * @return FilesystemInterface
  */
 public function createFilesystem($path = null)
 {
     $factory = new FilesystemAdapterFactory();
     return new Filesystem($factory->create('Local', [['path' => $path !== null ? $path : $this->path]]));
 }