Пример #1
0
 public function loadServices(Container $container)
 {
     // the ViewHelper
     $defViewHelper = new ClassDefinition('Nitronet\\Fwk\\Assetic\\AssetViewHelper', array($this->cfg('serviceName', 'assetic'), 'url', $this->cfg('debug', false), $this->cfg('action')));
     $container->set('assetic.ViewHelper', $defViewHelper, true);
     // filter manager
     $defFilterManager = new ClassDefinition('Assetic\\FilterManager');
     $container->set('assetic.FilterManager', $defFilterManager, true);
     // cssrewrite filter
     if ($this->cfg('cssrewrite', true) === true) {
         $defCssRewriteFilter = new ClassDefinition('Nitronet\\Fwk\\Assetic\\Filters\\CssRewriteFilter', array('@assetic.ViewHelper'));
         $container->set('assetic.CssRewriteFilter', $defCssRewriteFilter, true);
         $defFilterManager->addMethodCall('set', array('cssrewrite', '@assetic.CssRewriteFilter'));
     }
     // asset factory
     $defAssetFactory = new ClassDefinition('Assetic\\Factory\\AssetFactory', array($this->cfg('directory', null), $this->cfg('debug', false)));
     $defAssetFactory->addMethodCall('setFilterManager', array('@assetic.FilterManager'));
     $container->set('assetic.AssetFactory', $defAssetFactory, true);
     // service
     $defService = new ClassDefinition('Nitronet\\Fwk\\Assetic\\AssetsService', array('@assetic.AssetFactory'));
     $defService->addMethodCall('addShortcuts', array($this->shortcuts));
     $container->set($this->cfg('serviceName', 'assetic'), $defService, true);
     // caching
     if ($this->cfg('cache', false) === true) {
         $defFilesystemCache = new ClassDefinition('Assetic\\Cache\\FilesystemCache', array($this->cfg('cacheDir', sys_get_temp_dir())));
         $container->set('assetic.FilesystemCache', $defFilesystemCache, true);
         $defCacheBustingWorker = new ClassDefinition('Assetic\\Factory\\Worker\\CacheBustingWorker', array($this->cfg('cacheStrategy', 'content')));
         $container->set('assetic.CacheBustingWorker', $defCacheBustingWorker, true);
         $defAssetFactory->addMethodCall('addWorker', array('@assetic.CacheBustingWorker'));
         $defService->addArgument('@assetic.FilesystemCache');
         $defService->addArgument($this->cfg('cacheDir', sys_get_temp_dir()));
     }
     $container->setProperty('asseticServiceName', $this->cfg('serviceName', 'assetic'));
 }
Пример #2
0
 /**
  * Apply Plugin's services to the existing Container
  *
  * @param Container $container App's Services Container
  *
  * @return void
  */
 public function loadServices(Container $container)
 {
     $definition = new ClassDefinition('\\Fwk\\Core\\Components\\ResultType\\ResultTypeService', array(), true);
     foreach ($this->types as $name => $type) {
         $definition->addMethodCall('addType', array($name, $type));
     }
     $container->set(self::SERVICE_NAME, $definition, true);
 }
Пример #3
0
 /**
  * Apply Plugin's services to the existing Container
  *
  * @param Container $container App's Services Container
  *
  * @return void
  */
 public function loadServices(Container $container)
 {
     $definition = new ClassDefinition('\\Fwk\\Core\\Components\\ViewHelper\\ViewHelperService', array($this->propName, $this->throwExceptions), true);
     foreach ($this->helpers as $name => $helper) {
         $definition->addMethodCall('add', array($name, $helper));
     }
     $container->set(self::SERVICE_NAME, $definition, true);
 }