当前位置: 首页>>代码示例>>PHP>>正文


PHP ContainerBuilder::findByTag方法代码示例

本文整理汇总了PHP中Nette\DI\ContainerBuilder::findByTag方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::findByTag方法的具体用法?PHP ContainerBuilder::findByTag怎么用?PHP ContainerBuilder::findByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\DI\ContainerBuilder的用法示例。


在下文中一共展示了ContainerBuilder::findByTag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeCompile

 public function beforeCompile()
 {
     $config = $this->getConfig($this->defaults);
     $cacheDirectory = $config['cacheDir'] . "/";
     $tag = $this->prefix(static::LAZY);
     if ($config['autogenerateProxyClasses']) {
         foreach (array_keys($this->builder->findByTag($tag)) as $serviceName) {
             $this->createLazyProxy($serviceName);
         }
     } else {
         $this->proxyGenerator = new LazyLoadingValueHolderGenerator();
         foreach (array_keys($this->builder->findByTag($tag)) as $serviceName) {
             $this->createEagerProxy($serviceName, $cacheDirectory);
         }
     }
 }
开发者ID:radekdvorak,项目名称:nette-proxy-service,代码行数:16,代码来源:ProxyServiceExtension.php

示例2: getSortedConfigurators

 /**
  * @param ContainerBuilder $builder
  * @return array
  */
 private function getSortedConfigurators(ContainerBuilder $builder)
 {
     $configurators = $builder->findByTag(self::TAG_CONFIGURATOR);
     uasort($configurators, function ($a, $b) {
         $a = is_numeric($a) ? (double) $a : 0;
         $b = is_numeric($b) ? (double) $b : 0;
         return $a < $b ? -1 : ($a > $b ? 1 : 0);
     });
     return $configurators;
 }
开发者ID:lookyman,项目名称:nette-texy,代码行数:14,代码来源:TexyExtension.php

示例3: createSubscribersMap

 private function createSubscribersMap(\Nette\DI\ContainerBuilder $builder)
 {
     $map = [];
     foreach ($builder->findByTag(self::TAG_SUBSCRIBER) as $serviceName => $tagProperties) {
         $def = $builder->getDefinition($serviceName);
         $class = $def->getClass();
         $events = $class::getSubscribedEvents();
         foreach ($events as $eventName => $callbacks) {
             foreach ($callbacks as $function) {
                 $map[$eventName][] = [$serviceName, $function];
             }
         }
     }
     return $map;
 }
开发者ID:bazo,项目名称:nette-events-extension,代码行数:15,代码来源:EventsExtension.php

示例4: findRoutes

 /**
  * @param  Nette\DI\ContainerBuilder $builder
  * @return array
  */
 private function findRoutes(Nette\DI\ContainerBuilder $builder)
 {
     /**
      * Find all presenters and their routes
      */
     $presenters = $builder->findByTag('nette.presenter');
     $routes = [];
     foreach ($presenters as $presenter) {
         $this->findRoutesInPresenter($presenter, $routes);
     }
     /**
      * Return routes sorted by priority
      */
     return $this->sortByPriority($routes);
 }
开发者ID:ublaboo,项目名称:api-router,代码行数:19,代码来源:ApiRouterExtension.php

示例5: registerWidgets

 private function registerWidgets(ContainerBuilder $builder)
 {
     $widgets = $builder->getDefinition($this->prefix('widgets'));
     foreach (array_keys($builder->findByTag(self::WIDGET_TAG)) as $widget) {
         $definition = $builder->getDefinition($widget);
         if (!isset($definition->tags['name'])) {
             throw new InvalidArgumentException('Missing name for widget ' . $widget);
         }
         $name = $definition->tags['name'];
         $widgets->addSetup('addWidget', [$name, '@' . $widget]);
     }
 }
开发者ID:peterzadori,项目名称:movi,代码行数:12,代码来源:moviExtension.php

示例6: buildAuthorizatorList

 /**
  * @param \Nette\DI\ContainerBuilder $builder
  */
 private function buildAuthorizatorList(ContainerBuilder $builder)
 {
     $services = [];
     foreach ($builder->findByTag($this->prefix(self::AUTHORIZATOR_TAG)) as $name => $priority) {
         if (!Validators::isNumericInt($priority)) {
             throw new \Nette\InvalidArgumentException(sprintf('Authorizator priority for service %s has to be integer, %s given.', $name, gettype($priority)));
         }
         $services[(int) $priority][] = $name;
     }
     krsort($services);
     return iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($services)), FALSE);
 }
开发者ID:ark8,项目名称:security,代码行数:15,代码来源:SecurityExtension.php

示例7: afterCompile

 function afterCompile(ContainerBuilder $container, Nette\Utils\PhpGenerator\ClassType $class)
 {
     $initialize = $class->methods['initialize'];
     if (isset($container->parameters['tempDir'])) {
         $initialize->addBody($this->checkTempDir($container->expand($container->parameters['tempDir'])));
     }
     foreach ($container->findByTag('run') as $name => $foo) {
         $initialize->addBody('$this->getService(?);', array($name));
     }
 }
开发者ID:skapytek,项目名称:scripts,代码行数:10,代码来源:nette.min.php


注:本文中的Nette\DI\ContainerBuilder::findByTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。