private function initializeSourceFileSystem() { $this['sources.fileSystem.adapter'] = function ($c) { $paths = $c['sources.path']; if (!is_array($paths)) { $paths = array($paths); } $adapter = new MultipleAdapter(); foreach ($paths as $path) { $adapter->mount($path, new Local($path)); } return $adapter; }; $this['sources.fileSystem'] = function ($c) { return new Filesystem($c['sources.fileSystem.adapter']); }; $this['sources.fileSystem.finder'] = function ($c) { return $c['sources.fileSystem']; }; $this['sources.fileSystem.cached'] = function ($c) { $cache = $c['finder.cache.adapter']; $adapter = new Cache($c['sources.fileSystem.adapter'], $cache, $c['finder.cache.duration'], $cache); return new Filesystem($adapter); }; }
private function initializeSourceFileSystem() { $this['sources.fileSystem.adapter'] = function ($c) { $paths = $c['sources.path']; if (!is_array($paths)) { $paths = array($paths); } $adapter = new MultipleAdapter(); foreach ($paths as $path) { $localAdapter = new Local($path); if (is_file($path)) { $filename = basename($path); $path = realpath(dirname($path)); $localAdapter = new SingleLocalFile($filename, new Local($path)); } $adapter->mount($path, $localAdapter); } return $adapter; }; $this['target.fileSystem.adapter'] = function ($c) { if (!empty($c['target.path'])) { $c['hydrator.allowNonDistFilesOverwrite'] = true; return new Local($c['target.path']); } return $this['sources.fileSystem.adapter']; }; $this['target.fileSystem'] = function ($c) { return new Filesystem($c['target.fileSystem.adapter']); }; $this['sources.fileSystem'] = function ($c) { return new Filesystem($c['sources.fileSystem.adapter']); }; $this['sources.fileSystem.finder'] = function ($c) { return $c['sources.fileSystem']; }; $this['sources.fileSystem.cached'] = function ($c) { $cache = $c['finder.cache.adapter']; $adapter = new Cache($c['sources.fileSystem.adapter'], $cache, $c['finder.cache.duration'], $cache); return new Filesystem($adapter); }; }