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


PHP Definition::getTags方法代码示例

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


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

示例1: addService

 /**
  * Adds a service
  *
  * @param string     $id
  * @param Definition $definition
  *
  * @return string
  */
 private function addService($id, $definition)
 {
     $code = "    {$id}:\n";
     if ($definition->getClass()) {
         $code .= sprintf("        class: %s\n", $definition->getClass());
     }
     $tagsCode = '';
     foreach ($definition->getTags() as $name => $tags) {
         foreach ($tags as $attributes) {
             $att = array();
             foreach ($attributes as $key => $value) {
                 $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value));
             }
             $att = $att ? ', ' . implode(' ', $att) : '';
             $tagsCode .= sprintf("            - { name: %s%s }\n", $this->dumper->dump($name), $att);
         }
     }
     if ($tagsCode) {
         $code .= "        tags:\n" . $tagsCode;
     }
     if ($definition->getFile()) {
         $code .= sprintf("        file: %s\n", $definition->getFile());
     }
     if ($definition->isSynthetic()) {
         $code .= sprintf("        synthetic: true\n");
     }
     if ($definition->isSynchronized()) {
         $code .= sprintf("        synchronized: true\n");
     }
     if ($definition->getFactoryMethod()) {
         $code .= sprintf("        factory_method: %s\n", $definition->getFactoryMethod());
     }
     if ($definition->getFactoryService()) {
         $code .= sprintf("        factory_service: %s\n", $definition->getFactoryService());
     }
     if ($definition->getArguments()) {
         $code .= sprintf("        arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0));
     }
     if ($definition->getProperties()) {
         $code .= sprintf("        properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0));
     }
     if ($definition->getMethodCalls()) {
         $code .= sprintf("        calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12));
     }
     if (ContainerInterface::SCOPE_CONTAINER !== ($scope = $definition->getScope())) {
         $code .= sprintf("        scope: %s\n", $scope);
     }
     if ($callable = $definition->getConfigurator()) {
         if (is_array($callable)) {
             if ($callable[0] instanceof Reference) {
                 $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]);
             } else {
                 $callable = array($callable[0], $callable[1]);
             }
         }
         $code .= sprintf("        configurator: %s\n", $this->dumper->dump($callable, 0));
     }
     return $code;
 }
开发者ID:nfabre,项目名称:symfony,代码行数:67,代码来源:YamlDumper.php

示例2: addService

 /**
  * Adds a service.
  *
  * @param string     $id
  * @param Definition $definition
  *
  * @return string
  */
 private function addService($id, $definition)
 {
     $code = "    {$id}:\n";
     if ($definition->getClass()) {
         $code .= sprintf("        class: %s\n", $definition->getClass());
     }
     if (!$definition->isPublic()) {
         $code .= "        public: false\n";
     }
     $tagsCode = '';
     foreach ($definition->getTags() as $name => $tags) {
         foreach ($tags as $attributes) {
             $att = array();
             foreach ($attributes as $key => $value) {
                 $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value));
             }
             $att = $att ? ', ' . implode(', ', $att) : '';
             $tagsCode .= sprintf("            - { name: %s%s }\n", $this->dumper->dump($name), $att);
         }
     }
     if ($tagsCode) {
         $code .= "        tags:\n" . $tagsCode;
     }
     if ($definition->getFile()) {
         $code .= sprintf("        file: %s\n", $definition->getFile());
     }
     if ($definition->isSynthetic()) {
         $code .= sprintf("        synthetic: true\n");
     }
     if ($definition->isLazy()) {
         $code .= sprintf("        lazy: true\n");
     }
     if ($definition->getArguments()) {
         $code .= sprintf("        arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0));
     }
     if ($definition->getProperties()) {
         $code .= sprintf("        properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0));
     }
     if ($definition->getMethodCalls()) {
         $code .= sprintf("        calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12));
     }
     if (ContainerInterface::SCOPE_CONTAINER !== ($scope = $definition->getScope())) {
         $code .= sprintf("        scope: %s\n", $scope);
     }
     if (null !== ($decorated = $definition->getDecoratedService())) {
         list($decorated, $renamedId) = $decorated;
         $code .= sprintf("        decorates: %s\n", $decorated);
         if (null !== $renamedId) {
             $code .= sprintf("        decoration_inner_name: %s\n", $renamedId);
         }
     }
     if ($callable = $definition->getFactory()) {
         $code .= sprintf("        factory: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0));
     }
     if ($callable = $definition->getConfigurator()) {
         $code .= sprintf("        configurator: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0));
     }
     return $code;
 }
开发者ID:rgeraads,项目名称:symfony,代码行数:67,代码来源:YamlDumper.php

示例3: setDefinition

 public function setDefinition($id, Definition $definition)
 {
     if (!in_array($id, $this->ownServiceIds)) {
         if ($this->delegate->hasDefinition($id)) {
             throw new \LogicException('forbidden');
         } else {
             $this->ownServiceIds[] = $id;
         }
     }
     foreach ($definition->getTags() as $tag => $attributes) {
         if ($tag != 'kernel.event_listener') {
             throw new \LogicException('forbidden');
         }
     }
     $this->delegate->setDefinition($id, $definition);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:16,代码来源:SandboxContainerBuilder.php

示例4: describeContainerDefinition

 /**
  * {@inheritdoc}
  */
 protected function describeContainerDefinition(Definition $definition, array $options = array())
 {
     $description = isset($options['id']) ? array($this->formatSection('container', sprintf('Information for service <info>%s</info>', $options['id']))) : array();
     $description[] = sprintf('<comment>Service Id</comment>       %s', isset($options['id']) ? $options['id'] : '-');
     $description[] = sprintf('<comment>Class</comment>            %s', $definition->getClass() ?: "-");
     $tags = $definition->getTags();
     if (count($tags)) {
         $description[] = '<comment>Tags</comment>';
         foreach ($tags as $tagName => $tagData) {
             foreach ($tagData as $parameters) {
                 $description[] = sprintf('    - %-30s (%s)', $tagName, implode(', ', array_map(function ($key, $value) {
                     return sprintf('<info>%s</info>: %s', $key, $value);
                 }, array_keys($parameters), array_values($parameters))));
             }
         }
     } else {
         $description[] = '<comment>Tags</comment>             -';
     }
     $description[] = sprintf('<comment>Scope</comment>            %s', $definition->getScope());
     $description[] = sprintf('<comment>Public</comment>           %s', $definition->isPublic() ? 'yes' : 'no');
     $description[] = sprintf('<comment>Synthetic</comment>        %s', $definition->isSynthetic() ? 'yes' : 'no');
     $description[] = sprintf('<comment>Lazy</comment>             %s', $definition->isLazy() ? 'yes' : 'no');
     $description[] = sprintf('<comment>Synchronized</comment>     %s', $definition->isSynchronized() ? 'yes' : 'no');
     $description[] = sprintf('<comment>Abstract</comment>         %s', $definition->isAbstract() ? 'yes' : 'no');
     if ($definition->getFile()) {
         $description[] = sprintf('<comment>Required File</comment>    %s', $definition->getFile() ? $definition->getFile() : '-');
     }
     if ($definition->getFactoryClass()) {
         $description[] = sprintf('<comment>Factory Class</comment>    %s', $definition->getFactoryClass());
     }
     if ($definition->getFactoryService()) {
         $description[] = sprintf('<comment>Factory Service</comment>  %s', $definition->getFactoryService());
     }
     if ($definition->getFactoryMethod()) {
         $description[] = sprintf('<comment>Factory Method</comment>   %s', $definition->getFactoryMethod());
     }
     if ($factory = $definition->getFactory()) {
         if (is_array($factory)) {
             if ($factory[0] instanceof Reference) {
                 $description[] = sprintf('<comment>Factory Service</comment>  %s', $factory[0]);
             } elseif ($factory[0] instanceof Definition) {
                 throw new \InvalidArgumentException('Factory is not describable.');
             } else {
                 $description[] = sprintf('<comment>Factory Class</comment>    %s', $factory[0]);
             }
             $description[] = sprintf('<comment>Factory Method</comment>   %s', $factory[1]);
         } else {
             $description[] = sprintf('<comment>Factory Function</comment>    %s', $factory);
         }
     }
     $this->writeText(implode("\n", $description) . "\n", $options);
 }
开发者ID:Chaireeee,项目名称:chaireeee,代码行数:55,代码来源:TextDescriptor.php

示例5: describeContainerDefinition

 /**
  * {@inheritdoc}
  */
 protected function describeContainerDefinition(Definition $definition, array $options = array())
 {
     $output = '- Class: `' . $definition->getClass() . '`' . "\n" . '- Scope: `' . $definition->getScope() . '`' . "\n" . '- Public: ' . ($definition->isPublic() ? 'yes' : 'no') . "\n" . '- Synthetic: ' . ($definition->isSynthetic() ? 'yes' : 'no') . "\n" . '- Lazy: ' . ($definition->isLazy() ? 'yes' : 'no') . "\n" . '- Synchronized: ' . ($definition->isSynchronized() ? 'yes' : 'no') . "\n" . '- Abstract: ' . ($definition->isAbstract() ? 'yes' : 'no');
     if ($definition->getFile()) {
         $output .= "\n" . '- File: `' . $definition->getFile() . '`';
     }
     if ($definition->getFactoryClass()) {
         $output .= "\n" . '- Factory Class: `' . $definition->getFactoryClass() . '`';
     }
     if ($definition->getFactoryService()) {
         $output .= "\n" . '- Factory Service: `' . $definition->getFactoryService() . '`';
     }
     if ($definition->getFactoryMethod()) {
         $output .= "\n" . '- Factory Method: `' . $definition->getFactoryMethod() . '`';
     }
     if ($factory = $definition->getFactory()) {
         if (is_array($factory)) {
             if ($factory[0] instanceof Reference) {
                 $output .= "\n" . '- Factory Service: `' . $factory[0] . '`';
             } elseif ($factory[0] instanceof Definition) {
                 throw new \InvalidArgumentException('Factory is not describable.');
             } else {
                 $output .= "\n" . '- Factory Class: `' . $factory[0] . '`';
             }
             $output .= "\n" . '- Factory Method: `' . $factory[1] . '`';
         } else {
             $output .= "\n" . '- Factory Function: `' . $factory . '`';
         }
     }
     if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
         foreach ($definition->getTags() as $tagName => $tagData) {
             foreach ($tagData as $parameters) {
                 $output .= "\n" . '- Tag: `' . $tagName . '`';
                 foreach ($parameters as $name => $value) {
                     $output .= "\n" . '    - ' . ucfirst($name) . ': ' . $value;
                 }
             }
         }
     }
     $this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output);
 }
开发者ID:tonydub,项目名称:jarvis,代码行数:44,代码来源:MarkdownDescriptor.php

示例6: addService

    /**
     * Adds a service.
     *
     * @param string     $id
     * @param Definition $definition
     *
     * @return string
     */
    private function addService($id, $definition)
    {
        $code = "    $id:\n";
        if ($class = $definition->getClass()) {
            if ('\\' === substr($class, 0, 1)) {
                $class = substr($class, 1);
            }

            $code .= sprintf("        class: %s\n", $class);
        }

        if (!$definition->isPublic()) {
            $code .= "        public: false\n";
        }

        $tagsCode = '';
        foreach ($definition->getTags() as $name => $tags) {
            foreach ($tags as $attributes) {
                $att = array();
                foreach ($attributes as $key => $value) {
                    $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value));
                }
                $att = $att ? ', '.implode(', ', $att) : '';

                $tagsCode .= sprintf("            - { name: %s%s }\n", $this->dumper->dump($name), $att);
            }
        }
        if ($tagsCode) {
            $code .= "        tags:\n".$tagsCode;
        }

        if ($definition->getFile()) {
            $code .= sprintf("        file: %s\n", $definition->getFile());
        }

        if ($definition->isSynthetic()) {
            $code .= sprintf("        synthetic: true\n");
        }

        if ($definition->isLazy()) {
            $code .= sprintf("        lazy: true\n");
        }

        if ($definition->getArguments()) {
            $code .= sprintf("        arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0));
        }

        if ($definition->getProperties()) {
            $code .= sprintf("        properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0));
        }

        if ($definition->getMethodCalls()) {
            $code .= sprintf("        calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12));
        }

        if (!$definition->isShared()) {
            $code .= "        shared: false\n";
        }

        if (null !== $decorated = $definition->getDecoratedService()) {
            list($decorated, $renamedId, $priority) = $decorated;
            $code .= sprintf("        decorates: %s\n", $decorated);
            if (null !== $renamedId) {
                $code .= sprintf("        decoration_inner_name: %s\n", $renamedId);
            }
            if (0 !== $priority) {
                $code .= sprintf("        decoration_priority: %s\n", $priority);
            }
        }

        if ($callable = $definition->getFactory()) {
            $code .= sprintf("        factory: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0));
        }

        if ($callable = $definition->getConfigurator()) {
            $code .= sprintf("        configurator: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0));
        }

        return $code;
    }
开发者ID:ninvfeng,项目名称:symfony,代码行数:88,代码来源:YamlDumper.php

示例7: describeContainerDefinition

 /**
  * {@inheritdoc}
  */
 protected function describeContainerDefinition(Definition $definition, array $options = array())
 {
     $output = '- Class: `' . $definition->getClass() . '`' . "\n" . '- Scope: `' . $definition->getScope() . '`' . "\n" . '- Public: ' . ($definition->isPublic() ? 'yes' : 'no') . "\n" . '- Synthetic: ' . ($definition->isSynthetic() ? 'yes' : 'no');
     if ($definition->getFile()) {
         $output .= "\n" . '- File: `' . $definition->getFile() . '`';
     }
     if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
         foreach ($definition->getTags() as $tagName => $tagData) {
             foreach ($tagData as $parameters) {
                 $output .= "\n" . '- Tag: `' . $tagName . '`';
                 foreach ($parameters as $name => $value) {
                     $output .= "\n" . '    - ' . ucfirst($name) . ': ' . $value;
                 }
             }
         }
     }
     $this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output);
 }
开发者ID:makhloufi-lounis,项目名称:tuto_symfony,代码行数:21,代码来源:MarkdownDescriptor.php

示例8: describeContainerDefinition

 /**
  * {@inheritdoc}
  */
 protected function describeContainerDefinition(Definition $definition, array $options = array())
 {
     if (isset($options['id'])) {
         $options['output']->title(sprintf('Information for Service "<info>%s</info>"', $options['id']));
     }
     $tableHeaders = array('Option', 'Value');
     $tableRows[] = array('Service ID', isset($options['id']) ? $options['id'] : '-');
     $tableRows[] = array('Class', $definition->getClass() ?: '-');
     $tags = $definition->getTags();
     if (count($tags)) {
         $tagInformation = '';
         foreach ($tags as $tagName => $tagData) {
             foreach ($tagData as $tagParameters) {
                 $parameters = array_map(function ($key, $value) {
                     return sprintf('<info>%s</info>: %s', $key, $value);
                 }, array_keys($tagParameters), array_values($tagParameters));
                 $parameters = implode(', ', $parameters);
                 if ('' === $parameters) {
                     $tagInformation .= sprintf('%s', $tagName);
                 } else {
                     $tagInformation .= sprintf('%s (%s)', $tagName, $parameters);
                 }
             }
         }
     } else {
         $tagInformation = '-';
     }
     $tableRows[] = array('Tags', $tagInformation);
     $tableRows[] = array('Scope', $definition->getScope(false));
     $tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no');
     $tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no');
     $tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no');
     if (method_exists($definition, 'isSynchronized')) {
         $tableRows[] = array('Synchronized', $definition->isSynchronized(false) ? 'yes' : 'no');
     }
     $tableRows[] = array('Abstract', $definition->isAbstract() ? 'yes' : 'no');
     if (method_exists($definition, 'isAutowired')) {
         $tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no');
         $autowiringTypes = $definition->getAutowiringTypes();
         if (count($autowiringTypes)) {
             $autowiringTypesInformation = implode(', ', $autowiringTypes);
         } else {
             $autowiringTypesInformation = '-';
         }
         $tableRows[] = array('Autowiring Types', $autowiringTypesInformation);
     }
     if ($definition->getFile()) {
         $tableRows[] = array('Required File', $definition->getFile() ? $definition->getFile() : '-');
     }
     if ($definition->getFactoryClass(false)) {
         $tableRows[] = array('Factory Class', $definition->getFactoryClass(false));
     }
     if ($definition->getFactoryService(false)) {
         $tableRows[] = array('Factory Service', $definition->getFactoryService(false));
     }
     if ($definition->getFactoryMethod(false)) {
         $tableRows[] = array('Factory Method', $definition->getFactoryMethod(false));
     }
     if ($factory = $definition->getFactory()) {
         if (is_array($factory)) {
             if ($factory[0] instanceof Reference) {
                 $tableRows[] = array('Factory Service', $factory[0]);
             } elseif ($factory[0] instanceof Definition) {
                 throw new \InvalidArgumentException('Factory is not describable.');
             } else {
                 $tableRows[] = array('Factory Class', $factory[0]);
             }
             $tableRows[] = array('Factory Method', $factory[1]);
         } else {
             $tableRows[] = array('Factory Function', $factory);
         }
     }
     $options['output']->table($tableHeaders, $tableRows);
 }
开发者ID:robhaverkort,项目名称:belasting,代码行数:77,代码来源:TextDescriptor.php

示例9: assertValidRestFileLoader

 /**
  * Assert that loader definition described properly.
  *
  * @param Definition $loader               loader definition
  * @param string     $loaderClassParameter loader class parameter name
  */
 private function assertValidRestFileLoader(Definition $loader, $loaderClassParameter)
 {
     $locatorRef = new Reference('file_locator');
     $processorRef = new Reference('fos_rest.routing.loader.processor');
     $arguments = $loader->getArguments();
     $this->assertEquals('%' . $loaderClassParameter . '%', $loader->getClass());
     $this->assertEquals(2, count($arguments));
     $this->assertEquals($locatorRef, $arguments[0]);
     $this->assertEquals($processorRef, $arguments[1]);
     $this->assertArrayHasKey('routing.loader', $loader->getTags());
 }
开发者ID:CrisMenjivar,项目名称:TesisSIIGv1,代码行数:17,代码来源:FOSRestExtensionTest.php

示例10: getTags

 /**
  * Get all tags.
  *
  * @return array An array of tags
  *
  * @api
  * @since 4.0.0
  */
 public function getTags()
 {
     return $this->_underlyingSymfonyDefinition->getTags();
 }
开发者ID:tubepress,项目名称:tubepress,代码行数:12,代码来源:Definition.php

示例11: assertConfigCacheDefinition

 protected function assertConfigCacheDefinition(Definition $definition, $doctrineCacheId)
 {
     // arguments
     $arguments = $definition->getArguments();
     $this->assertSame(2, count($arguments));
     $this->assertEquals(new Reference($doctrineCacheId), $arguments[0]);
     $this->assertEquals(new Reference('yahoo_japan_config_cache.delegating_loader'), $arguments[1]);
     // method calls
     $methodCalls = $definition->getMethodCalls();
     $this->assertSame(4, count($methodCalls));
     // only assert method name
     $this->assertSame('setArrayAccess', $methodCalls[0][0]);
     $this->assertSame('addResource', $methodCalls[1][0]);
     $this->assertSame('setStrict', $methodCalls[2][0]);
     $this->assertSame('setId', $methodCalls[3][0]);
     // tags
     $this->assertTrue(array_key_exists(ConfigCache::TAG_CACHE_WARMER, $definition->getTags()));
 }
开发者ID:yahoojapan,项目名称:ConfigCacheBundle,代码行数:18,代码来源:RegisterPassTest.php

示例12: getContainerDefinitionData

 /**
  * @param Definition $definition
  * @param bool       $omitTags
  *
  * @return array
  */
 private function getContainerDefinitionData(Definition $definition, $omitTags = false)
 {
     $data = array('class' => (string) $definition->getClass(), 'scope' => $definition->getScope(), 'public' => $definition->isPublic(), 'synthetic' => $definition->isSynthetic(), 'lazy' => $definition->isLazy(), 'synchronized' => $definition->isSynchronized(), 'abstract' => $definition->isAbstract(), 'file' => $definition->getFile());
     if ($definition->getFactoryClass()) {
         $data['factory_class'] = $definition->getFactoryClass();
     }
     if ($definition->getFactoryService()) {
         $data['factory_service'] = $definition->getFactoryService();
     }
     if ($definition->getFactoryMethod()) {
         $data['factory_method'] = $definition->getFactoryMethod();
     }
     if ($factory = $definition->getFactory()) {
         if (is_array($factory)) {
             if ($factory[0] instanceof Reference) {
                 $data['factory_service'] = (string) $factory[0];
             } elseif ($factory[0] instanceof Definition) {
                 throw new \InvalidArgumentException('Factory is not describable.');
             } else {
                 $data['factory_class'] = $factory[0];
             }
             $data['factory_method'] = $factory[1];
         } else {
             $data['factory_function'] = $factory;
         }
     }
     if (!$omitTags) {
         $data['tags'] = array();
         if (count($definition->getTags())) {
             foreach ($definition->getTags() as $tagName => $tagData) {
                 foreach ($tagData as $parameters) {
                     $data['tags'][] = array('name' => $tagName, 'parameters' => $parameters);
                 }
             }
         }
     }
     return $data;
 }
开发者ID:tonydub,项目名称:jarvis,代码行数:44,代码来源:JsonDescriptor.php

示例13: hydrateDefinitionTags

 /**
  * Hydrate definition tags from entity into definition array.
  *
  * @param Definition $definition       the definition to convert
  * @param array      $definitionArray the definition array (passed by reference)
  */
 private function hydrateDefinitionTags(Definition $definition, array &$definitionArray)
 {
     foreach ($definition->getTags() as $key => $tag) {
         $definitionTag = ['name' => $key];
         foreach (array_shift($tag) as $key => $option) {
             $definitionTag[$key] = $option;
         }
         $definitionArray['tags'][] = $definitionTag;
     }
 }
开发者ID:mickaelsteinberg,项目名称:BackBee,代码行数:16,代码来源:PhpArrayDumper.php

示例14: getContainerDefinitionDocument

    /**
     * @param Definition  $definition
     * @param string|null $id
     * @param boolean     $omitTags
     *
     * @return \DOMDocument
     */
    private function getContainerDefinitionDocument(Definition $definition, $id = null, $omitTags = false)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->appendChild($serviceXML = $dom->createElement('definition'));

        if ($id) {
            $serviceXML->setAttribute('id', $id);
        }

        $serviceXML->setAttribute('class', $definition->getClass());
        $serviceXML->setAttribute('scope', $definition->getScope());
        $serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false');
        $serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false');
        $serviceXML->setAttribute('file', $definition->getFile());

        if (!$omitTags) {
            $tags = $definition->getTags();

            if (count($tags) > 0) {
                $serviceXML->appendChild($tagsXML = $dom->createElement('tags'));
                foreach ($tags as $tagName => $tagData) {
                    foreach ($tagData as $parameters) {
                        $tagsXML->appendChild($tagXML = $dom->createElement('tag'));
                        $tagXML->setAttribute('name', $tagName);
                        foreach ($parameters as $name => $value) {
                            $tagXML->appendChild($parameterXML = $dom->createElement('parameter'));
                            $parameterXML->setAttribute('name', $name);
                            $parameterXML->textContent = $value;
                        }
                    }
                }
            }
        }

        return $dom;
    }
开发者ID:Gregwar,项目名称:symfony,代码行数:43,代码来源:XmlDescriptor.php

示例15: getContainerDefinitionDocument

 /**
  * @param Definition  $definition
  * @param string|null $id
  * @param bool        $omitTags
  *
  * @return \DOMDocument
  */
 private function getContainerDefinitionDocument(Definition $definition, $id = null, $omitTags = false)
 {
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->appendChild($serviceXML = $dom->createElement('definition'));
     if ($id) {
         $serviceXML->setAttribute('id', $id);
     }
     $serviceXML->setAttribute('class', $definition->getClass());
     if ($definition->getFactoryClass()) {
         $serviceXML->setAttribute('factory-class', $definition->getFactoryClass());
     }
     if ($definition->getFactoryService()) {
         $serviceXML->setAttribute('factory-service', $definition->getFactoryService());
     }
     if ($definition->getFactoryMethod()) {
         $serviceXML->setAttribute('factory-method', $definition->getFactoryMethod());
     }
     $serviceXML->setAttribute('scope', $definition->getScope());
     $serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false');
     $serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false');
     $serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false');
     $serviceXML->setAttribute('synchronized', $definition->isSynchronized() ? 'true' : 'false');
     $serviceXML->setAttribute('abstract', $definition->isAbstract() ? 'true' : 'false');
     $serviceXML->setAttribute('file', $definition->getFile());
     if (!$omitTags) {
         $tags = $definition->getTags();
         if (count($tags) > 0) {
             $serviceXML->appendChild($tagsXML = $dom->createElement('tags'));
             foreach ($tags as $tagName => $tagData) {
                 foreach ($tagData as $parameters) {
                     $tagsXML->appendChild($tagXML = $dom->createElement('tag'));
                     $tagXML->setAttribute('name', $tagName);
                     foreach ($parameters as $name => $value) {
                         $tagXML->appendChild($parameterXML = $dom->createElement('parameter'));
                         $parameterXML->setAttribute('name', $name);
                         $parameterXML->appendChild(new \DOMText($this->formatParameter($value)));
                     }
                 }
             }
         }
     }
     return $dom;
 }
开发者ID:brennantom,项目名称:hackazon,代码行数:50,代码来源:XmlDescriptor.php


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