/**
  * Adds support for pipeline assets.
  *
  * {@inheritdoc}
  */
 protected function parseInput($input, array $options = array())
 {
     if (is_string($input) && '|' == $input[0]) {
         switch (pathinfo($options['output'], PATHINFO_EXTENSION)) {
             case 'js':
                 $type = 'js';
                 break;
             case 'css':
                 $type = 'css';
                 break;
             default:
                 throw new \RuntimeException('Unsupported pipeline asset type provided: ' . $input);
         }
         $assets = new AssetCollection();
         foreach ($this->locator->locatePipelinedAssets(substr($input, 1), $type) as $formula) {
             $filters = array();
             if ($formula['filter']) {
                 $filters[] = $this->getFilter($formula['filter']);
             }
             $asset = new FileAsset($formula['root'] . '/' . $formula['file'], $filters, $options['root'][0], $formula['file']);
             $asset->setTargetPath($formula['file']);
             $assets->add($asset);
         }
         return $assets;
     }
     return parent::parseInput($input, $options);
 }
Пример #2
0
 /**
  * Adds dynamic settings notation support: $<paramName>[;<namespace>[;<scope>]]$.
  *
  * {@inheritdoc}
  */
 protected function parseInput($input, array $options = array())
 {
     if ($this->dynamicSettingParser->isDynamicSetting($input)) {
         $parsedSettings = $this->dynamicSettingParser->parseDynamicSetting($input);
         $input = $this->configResolver->getParameter($parsedSettings['param'], $parsedSettings['namespace'], $parsedSettings['scope']);
         if (is_array($input)) {
             $collection = $this->createAssetCollection(array(), $options);
             foreach ($input as $file) {
                 $collection->add(parent::parseInput($file, $options));
             }
             return $collection;
         }
     }
     return parent::parseInput($input, $options);
 }