예제 #1
0
 /**
  * @param string $path
  * @return ConfigInterface
  */
 private function createConfig($path)
 {
     if (!is_dir($path)) {
         return new Config();
     }
     $factory = new FilesystemAdapterFactory();
     return (new ConfigFactory(new Filesystem($factory->create('Local', [['path' => $path]]))))->create();
 }
예제 #2
0
 /**
  * @param CoreInterface $core
  */
 protected function register(CoreInterface $core)
 {
     $config = $core->make('Surume\\Config\\ConfigInterface');
     $factory = new FilesystemAdapterFactory();
     $fsCloud = new FilesystemManager();
     $fsDisk = new Filesystem($factory->create('Local', [['path' => $core->basePath()]]));
     $disks = $config->get('filesystem.cloud');
     foreach ($disks as $disk => $config) {
         $fsCloud->mountFilesystem($disk, new Filesystem($factory->create($config['factory'], [$config['config']])));
     }
     $core->instance('Surume\\Filesystem\\FilesystemInterface', $fsDisk);
     $core->instance('Surume\\Filesystem\\FilesystemManagerInterface', $fsCloud);
 }