Example #1
0
 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $builder)
 {
     $ids = $builder->findTaggedServiceIds('console.helper');
     $helperSet = $builder->getDefinition('console.helper_set');
     foreach ($ids as $id => $tags) {
         $helper = $builder->getDefinition($id);
         if ($helper->isAbstract()) {
             throw Exception::helperIsAbstract($id);
         }
         if (!$helper->isPublic()) {
             throw Exception::helperIsNotPublic($id);
         }
         $reflect = new ReflectionClass($helper->getClass());
         if (!$reflect->isSubclassOf('Symfony\\Component\\Console\\Helper\\Helper')) {
             throw Exception::helperIsNotHelper($id);
         }
         foreach ($tags as $tag) {
             $helperSet->addMethodCall('set', array(new Reference($id), isset($tag['alias']) ? $tag['alias'] : null));
         }
     }
 }