/** * Build collection of assets. */ public function build() { $moduleConfiguration = $this->configuration->getModules(); foreach ($moduleConfiguration as $configuration) { $factory = $this->createAssetFactory($configuration); $collections = (array) $configuration['collections']; foreach ($collections as $name => $options) { $this->prepareCollection($options, $name, $factory); } } }
public function initLoadedModules(array $loadedModules) { $moduleConfiguration = $this->configuration->getModules(); foreach ($loadedModules as $moduleName => $module) { $moduleName = strtolower($moduleName); if (!isset($moduleConfiguration[$moduleName])) { continue; } $conf = (array) $moduleConfiguration[$moduleName]; $factory = new Factory\AssetFactory($conf['root_path']); $factory->setAssetManager($this->getAssetManager()); $factory->setFilterManager($this->getFilterManager()); $factory->setDebug($this->configuration->isDebug()); $collections = (array) $conf['collections']; foreach ($collections as $name => $options) { $assets = isset($options['assets']) ? $options['assets'] : array(); $filters = isset($options['filters']) ? $options['filters'] : array(); $options = isset($options['options']) ? $options['options'] : array(); $options['output'] = isset($options['output']) ? $options['output'] : $name; $filters = $this->initFilters($filters); /** @var $asset \Assetic\Asset\AssetCollection */ $asset = $factory->createAsset($assets, $filters, $options); # allow to move all files 1:1 to new directory # its particulary usefull when this assets are images. if (isset($options['move_raw']) && $options['move_raw']) { foreach ($asset as $key => $value) { $name = md5($value->getSourceRoot() . $value->getSourcePath()); $value->setTargetPath($value->getSourcePath()); $value = $this->cache($value); $this->assetManager->set($name, $value); } } else { $asset = $this->cache($asset); $this->assetManager->set($name, $asset); } } $writer = new AssetWriter($this->configuration->getWebPath()); $writer->writeManagerAssets($this->assetManager); } }
public function testGetModules() { $expected = array(); $result = $this->object->getModules(); $this->assertEquals($expected, $result); }