當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ContainerInterface::findTaggedServiceIds方法代碼示例

本文整理匯總了PHP中Symfony\Component\DependencyInjection\ContainerInterface::findTaggedServiceIds方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContainerInterface::findTaggedServiceIds方法的具體用法?PHP ContainerInterface::findTaggedServiceIds怎麽用?PHP ContainerInterface::findTaggedServiceIds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\DependencyInjection\ContainerInterface的用法示例。


在下文中一共展示了ContainerInterface::findTaggedServiceIds方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTasks

 /**
  * Get defined tasks
  *
  * @return array
  */
 public function getTasks()
 {
     $tasks = array();
     $tags = $this->container->findTaggedServiceIds('grumphp.task');
     foreach ($tags as $id => $tags) {
         $tasks[] = $this->locateConfigKey($tags);
     }
     return $tasks;
 }
開發者ID:Bilge,項目名稱:grumphp,代碼行數:14,代碼來源:GrumPHP.php

示例2: __construct

 /**
  * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
  * @return void
  */
 public function __construct(ContainerInterface $container)
 {
     $this->container = $container;
     $this->menus = array();
     foreach ($this->container->findTaggedServiceIds('menu') as $id => $attributes) {
         if (isset($attributes[0]['alias'])) {
             $this->menus[$attributes[0]['alias']] = $id;
         }
     }
 }
開發者ID:vjousse,項目名稱:MenuBundle,代碼行數:14,代碼來源:MenuHelper.php

示例3: __construct

 public function __construct(ContainerInterface $container, ProfilerStorageInterface $storage, LoggerInterface $logger = null)
 {
     parent::__construct($storage, $logger);
     foreach ($container->findTaggedServiceIds('data_collector') as $id => $attributes) {
         $this->add($container->get($id));
     }
 }
開發者ID:skoop,項目名稱:symfony-sandbox,代碼行數:7,代碼來源:Profiler.php

示例4: __construct

 public function __construct(ContainerInterface $container, \Twig_LoaderInterface $loader = null, $options = array())
 {
     parent::__construct($loader, $options);
     foreach ($container->findTaggedServiceIds('twig.extension') as $id => $attributes) {
         $this->addExtension($container->get($id));
     }
 }
開發者ID:spf13,項目名稱:symfony,代碼行數:7,代碼來源:Environment.php

示例5: setContainer

 public function setContainer(ContainerInterface $container)
 {
     foreach ($container->findTaggedServiceIds('kernel.listener') as $id => $attributes) {
         $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
         $container->get($id)->register($this, $priority);
     }
 }
開發者ID:skoop,項目名稱:symfony-sandbox,代碼行數:7,代碼來源:EventDispatcher.php

示例6: __construct

 /**
  * Constructor.
  *
  * @param VoterInterface[] $voters                     An array of VoterInterface instances
  * @param string           $strategy                   The vote strategy
  * @param Boolean          $allowIfAllAbstainDecisions Whether to grant access if all voters abstained or not
  */
 public function __construct(ContainerInterface $container, $strategy = 'affirmative', $allowIfAllAbstainDecisions = false, $allowIfEqualGrantedDeniedDecisions = true)
 {
     parent::__construct(array(), $strategy, $allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions);
     $this->voters = array();
     foreach ($container->findTaggedServiceIds('security.voter') as $id => $attributes) {
         $this->voters[] = $container->get($id);
     }
 }
開發者ID:notmessenger,項目名稱:ZF-REST-API,代碼行數:15,代碼來源:AccessDecisionManager.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param ContainerInterface $container A ContainerInterface instance
  * @param LoaderInterface[]  $loaders An array of loaders
  */
 public function __construct(ContainerInterface $container, array $loaders = array())
 {
     parent::__construct($loaders);
     $this->container = $container;
     foreach ($container->findTaggedServiceIds('routing.loader') as $id => $attributes) {
         $this->services[] = $id;
     }
 }
開發者ID:skoop,項目名稱:symfony-sandbox,代碼行數:14,代碼來源:LoaderResolver.php

示例8: createGenerator

 /**
  * Creates a new generator or returns an existing instance for the given
  * <b>$identifier</b>.
  *
  * @param string $identifier The generator identifier.
  * @param string $fileName The log output file name.
  * @return \PDepend\Report\ReportGenerator
  * @throws \RuntimeException
  */
 public function createGenerator($identifier, $fileName)
 {
     if (!isset($this->instances[$identifier])) {
         $loggerServices = $this->container->findTaggedServiceIds('pdepend.logger');
         $logger = null;
         foreach ($loggerServices as $id => $loggerServiceTags) {
             foreach ($loggerServiceTags as $loggerServiceTag) {
                 if ($loggerServiceTag['option'] === '--' . $identifier) {
                     $logger = $this->container->get($id);
                 }
             }
         }
         if (!$logger) {
             throw new \RuntimeException(sprintf('Unknown generator with identifier "%s".', $identifier));
         }
         // TODO: Refactor this into an external log configurator or a similar
         //       concept.
         if ($logger instanceof FileAwareGenerator) {
             $logger->setLogFile($fileName);
         }
         $this->instances[$identifier] = $logger;
     }
     return $this->instances[$identifier];
 }
開發者ID:eduardobenito10,項目名稱:jenkins-php-quickstart,代碼行數:33,代碼來源:ReportGeneratorFactory.php

示例9: __construct

 public function __construct(ContainerInterface $container)
 {
     foreach ($container->findTaggedServiceIds('kernel.listener') as $id => $attributes) {
         $container->get($id)->register($this);
     }
 }
開發者ID:roydonstharayil,項目名稱:sugarbox,代碼行數:6,代碼來源:bootstrap.php


注:本文中的Symfony\Component\DependencyInjection\ContainerInterface::findTaggedServiceIds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。