本文整理匯總了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;
}
示例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;
}
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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];
}
示例9: __construct
public function __construct(ContainerInterface $container)
{
foreach ($container->findTaggedServiceIds('kernel.listener') as $id => $attributes) {
$container->get($id)->register($this);
}
}