Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * @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;
         }
     }
 }
Example #3
0
 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));
     }
 }
Example #4
0
 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));
     }
 }
 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);
     }
 }
 /**
  * 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);
     }
 }
Example #7
0
 /**
  * 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;
     }
 }
 /**
  * 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];
 }
Example #9
0
 public function __construct(ContainerInterface $container)
 {
     foreach ($container->findTaggedServiceIds('kernel.listener') as $id => $attributes) {
         $container->get($id)->register($this);
     }
 }