示例#1
0
 /**
  * Creates backend filesystem
  *
  * @param array               $backendConfig
  * @param AdapterInterface    $adapter
  * @param array|null          $filesystemConfig
  * @param CacheInterface|null $cache
  *
  * @return Backend
  */
 public function createBackend(array $backendConfig, AdapterInterface $adapter, array $filesystemConfig = null, CacheInterface $cache = null)
 {
     if ($adapter instanceof ContainerAwareInterface) {
         $adapter->setContainer($this->app);
     }
     if (null === $cache) {
         $cache = new MemoryCache();
     }
     $cachedAdapter = new CachedAdapter($adapter, $cache);
     if (array_key_exists($backendConfig['adapter'], static::$trackedOperations)) {
         $backendConfig['trackedOperations'] = static::$trackedOperations[$backendConfig['adapter']];
     }
     return new Backend($backendConfig, $this->app, $cachedAdapter, $filesystemConfig);
 }