コード例 #1
0
ファイル: Executor.php プロジェクト: ThrusterIO/actions
 /**
  * @inheritDoc
  */
 public function getExecutor(string $actionName) : ActionExecutorInterface
 {
     if (arrayKeyNotExists($actionName, $this->executors)) {
         throw new ActionExecutorNotFoundException($actionName);
     }
     return $this->executors[$actionName];
 }
コード例 #2
0
 /**
  * @inheritDoc
  */
 public function process(ContainerBuilder $container)
 {
     $groupsId = 'thruster_data_modifiers';
     $groupsDefinition = new Definition('Thruster\\Component\\DataModifier\\DataModifierGroups');
     $container->setDefinition($groupsId, $groupsDefinition);
     foreach ($container->findTaggedServiceIds('thruster_data_modifier') as $id => $tags) {
         foreach ($tags as $tag) {
             if (arrayKeyNotExists('group', $tag)) {
                 throw new \LogicException(sprintf('DataModifier tag requires attribute "group" in definition "%s"', $id));
             }
             $groupName = $tag['group'];
             $priority = get($tag, 'priority', 0);
             $groupId = 'thruster_data_modifier.group.' . $groupName;
             if ($container->hasDefinition($groupId)) {
                 $groupDefinition = $container->getDefinition($groupId);
             } else {
                 $groupDefinition = new Definition('Thruster\\Component\\DataModifier\\DataModifierGroup');
                 $container->setDefinition($groupId, $groupDefinition);
                 $groupsDefinition->addMethodCall('addGroup', [$groupName, new Reference($groupId)]);
             }
             $groupDefinition->addMethodCall('addModifier', [new Reference($id), $priority]);
         }
     }
 }