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


PHP ContainerBuilder::findTags方法代码示例

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


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

示例1: testServicesDefinitionTest

 public function testServicesDefinitionTest()
 {
     $this->createFullConfiguration();
     $tags = $this->configuration->findTags();
     $this->assertEquals('form.type', $tags[0]);
     $taggedServices = $this->configuration->findTaggedServiceIds($tags[0]);
     $this->assertTrue(isset($taggedServices['acme_cart.cart.form.type']));
     $this->assertEquals('leaphly_cart', $taggedServices['acme_cart.cart.form.type'][0]['alias']);
     $this->assertTrue(isset($taggedServices['acme_cart.cart.limited.form.type']));
     $this->assertEquals('leaphly_cart_limited', $taggedServices['acme_cart.cart.limited.form.type'][0]['alias']);
 }
开发者ID:leaphly,项目名称:leaphly-sandbox,代码行数:11,代码来源:CartBundleExtensionTest.php

示例2: outputTags

 /**
  * Renders list of tagged services grouped by tag.
  *
  * @param OutputInterface $output
  * @param bool            $showPrivate
  */
 protected function outputTags(OutputInterface $output, $showPrivate = false)
 {
     $tags = $this->containerBuilder->findTags();
     asort($tags);
     $label = 'Tagged services';
     $output->writeln($this->getHelper('formatter')->formatSection('container', $label));
     foreach ($tags as $tag) {
         $serviceIds = $this->containerBuilder->findTaggedServiceIds($tag);
         foreach ($serviceIds as $serviceId => $attributes) {
             $definition = $this->resolveServiceDefinition($serviceId);
             if ($definition instanceof Definition) {
                 if (!$showPrivate && !$definition->isPublic()) {
                     unset($serviceIds[$serviceId]);
                     continue;
                 }
             }
         }
         if (count($serviceIds) === 0) {
             continue;
         }
         $output->writeln($this->getHelper('formatter')->formatSection('tag', $tag));
         foreach ($serviceIds as $serviceId => $attributes) {
             $output->writeln($serviceId);
         }
         $output->writeln('');
     }
 }
开发者ID:mesushan,项目名称:FirstRepo,代码行数:33,代码来源:ContainerDebugCommand.php

示例3: process

 public function process(ContainerBuilder $container)
 {
     $compiler = $container->getCompiler();
     $formatter = $compiler->getLoggingFormatter();
     $tags = array_unique(array_merge($container->findTags(), $this->whitelist));
     foreach ($container->findUnusedTags() as $tag) {
         // skip whitelisted tags
         if (in_array($tag, $this->whitelist)) {
             continue;
         }
         // check for typos
         $candidates = array();
         foreach ($tags as $definedTag) {
             if ($definedTag === $tag) {
                 continue;
             }
             if (false !== strpos($definedTag, $tag) || levenshtein($tag, $definedTag) <= strlen($tag) / 3) {
                 $candidates[] = $definedTag;
             }
         }
         $services = array_keys($container->findTaggedServiceIds($tag));
         $message = sprintf('Tag "%s" was defined on service(s) "%s", but was never used.', $tag, implode('", "', $services));
         if (!empty($candidates)) {
             $message .= sprintf(' Did you mean "%s"?', implode('", "', $candidates));
         }
         $compiler->addLogMessage($formatter->format($this, $message));
     }
 }
开发者ID:skelpo,项目名称:framework,代码行数:28,代码来源:UnusedTagsPass.php

示例4: addCustom

    protected function addCustom($options)
    {
        $tags = array();
        foreach ($this->container->findTags() as $tag) {
            $tags[$tag] = array_keys($this->container->findTaggedServiceIds($tag));
        }
        $configurations = array();
        $disabled = array();
        foreach ($options['nucleus']['services'] as $serviceName => $serviceDefinition) {
            $configurations[$serviceName] = null;
            if (isset($serviceDefinition['disabled']) && $serviceDefinition['disabled']) {
                $disabled[] = $serviceName;
            }
            if (isset($serviceDefinition['configuration'])) {
                $configurations[$serviceName] = $serviceDefinition['configuration'];
            }
        }
        return '
    protected $tags = ' . var_export($tags, true) . ';
      
    protected $disabled = ' . var_export($disabled, true) . ';
';
    }
开发者ID:mpoiriert,项目名称:nucleus,代码行数:23,代码来源:PhpDumper.php

示例5: findDefinitionsByTag

 /**
  * @param ContainerBuilder $builder
  * @param bool             $showPrivate
  *
  * @return array
  */
 protected function findDefinitionsByTag(ContainerBuilder $builder, $showPrivate)
 {
     $definitions = array();
     $tags = $builder->findTags();
     asort($tags);
     foreach ($tags as $tag) {
         foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) {
             $definition = $this->resolveServiceDefinition($builder, $serviceId);
             if (!$definition instanceof Definition || !$showPrivate && !$definition->isPublic()) {
                 continue;
             }
             if (!isset($definitions[$tag])) {
                 $definitions[$tag] = array();
             }
             $definitions[$tag][$serviceId] = $definition;
         }
     }
     return $definitions;
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:25,代码来源:Descriptor.php

示例6: findTags

 /**
  * Returns all tags the defined services use.
  *
  * @return array An array of tags
  *
  * @api
  * @since 4.0.0
  */
 public function findTags()
 {
     return $this->_delegateContainerBuilder->findTags();
 }
开发者ID:tubepress,项目名称:tubepress,代码行数:12,代码来源:ContainerBuilder.php


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