@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | final class ParamMapperPass implements CompilerPassInterface |
| 11 | 11 | { |
| 12 | - public const COLLECTOR_SVC_ID = 'eps.req2cmd.collector.param_collector'; |
|
| 13 | - public const MAPPER_TAG = 'req2cmd.param_mapper'; |
|
| 12 | + public const COLLECTOR_SVC_ID='eps.req2cmd.collector.param_collector'; |
|
| 13 | + public const MAPPER_TAG='req2cmd.param_mapper'; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * {@inheritdoc} |
@@ -21,20 +21,20 @@ discard block |
||
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $collector = $container->findDefinition(self::COLLECTOR_SVC_ID); |
|
| 25 | - $mappersDefinitions = $container->findTaggedServiceIds(self::MAPPER_TAG); |
|
| 26 | - $queue = new \SplPriorityQueue(); |
|
| 24 | + $collector=$container->findDefinition(self::COLLECTOR_SVC_ID); |
|
| 25 | + $mappersDefinitions=$container->findTaggedServiceIds(self::MAPPER_TAG); |
|
| 26 | + $queue=new \SplPriorityQueue(); |
|
| 27 | 27 | |
| 28 | 28 | foreach ($mappersDefinitions as $mapperId => $mapperTags) { |
| 29 | 29 | foreach ($mapperTags as $tagAttributes) { |
| 30 | - $priority = $tagAttributes['priority'] ?? 0; |
|
| 30 | + $priority=$tagAttributes['priority'] ?? 0; |
|
| 31 | 31 | $queue->insert($mapperId, $priority); |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $mappers = []; |
|
| 35 | + $mappers=[]; |
|
| 36 | 36 | foreach ($queue as $mapperId) { |
| 37 | - $mappers[] = new Reference($mapperId); |
|
| 37 | + $mappers[]=new Reference($mapperId); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $collector->replaceArgument(0, $mappers); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function __construct(CommandBus $commandBus) |
| 16 | 16 | { |
| 17 | - $this->commandBus = $commandBus; |
|
| 17 | + $this->commandBus=$commandBus; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function handleCommand($command): void |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function __construct(CommandBusInterface $commandBus) |
| 18 | 18 | { |
| 19 | - $this->commandBus = $commandBus; |
|
| 19 | + $this->commandBus=$commandBus; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function __invoke(Request $request): Response |
| 23 | 23 | { |
| 24 | - $command = $request->attributes->get('_command'); |
|
| 24 | + $command=$request->attributes->get('_command'); |
|
| 25 | 25 | if ($command === null) { |
| 26 | 26 | throw new \InvalidArgumentException('No _command argument found for action'); |
| 27 | 27 | } |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | switch ($request->getMethod()) { |
| 36 | 36 | case Request::METHOD_PUT: |
| 37 | - $statusCode = Response::HTTP_OK; |
|
| 37 | + $statusCode=Response::HTTP_OK; |
|
| 38 | 38 | break; |
| 39 | 39 | case Request::METHOD_POST: |
| 40 | - $statusCode = Response::HTTP_CREATED; |
|
| 40 | + $statusCode=Response::HTTP_CREATED; |
|
| 41 | 41 | break; |
| 42 | 42 | case Request::METHOD_DELETE: |
| 43 | - $statusCode = Response::HTTP_NO_CONTENT; |
|
| 43 | + $statusCode=Response::HTTP_NO_CONTENT; |
|
| 44 | 44 | break; |
| 45 | 45 | default: |
| 46 | - $statusCode = Response::HTTP_OK; |
|
| 46 | + $statusCode=Response::HTTP_OK; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $statusCode; |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function load(array $configs, ContainerBuilder $container): void |
| 19 | 19 | { |
| 20 | - $configuration = new Req2CmdConfiguration(); |
|
| 21 | - $config = $this->processConfiguration($configuration, $configs); |
|
| 20 | + $configuration=new Req2CmdConfiguration(); |
|
| 21 | + $config=$this->processConfiguration($configuration, $configs); |
|
| 22 | 22 | |
| 23 | - $loader = new XmlFileLoader( |
|
| 23 | + $loader=new XmlFileLoader( |
|
| 24 | 24 | $container, |
| 25 | - new FileLocator(__DIR__ . '/../Resources/config') |
|
| 25 | + new FileLocator(__DIR__.'/../Resources/config') |
|
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | 28 | $loader->load('actions.xml'); |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | private function configureExtractors(array $config, ContainerBuilder $container): void |
| 45 | 45 | { |
| 46 | - $extractorId = (string)$config['extractor']['service_id']; |
|
| 46 | + $extractorId=(string) $config['extractor']['service_id']; |
|
| 47 | 47 | $container->setAlias('eps.req2cmd.extractor', $extractorId); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | private function configureCommandBus(array $config, ContainerBuilder $container): void |
| 51 | 51 | { |
| 52 | - $commandBusId = (string)$config['command_bus']['service_id']; |
|
| 52 | + $commandBusId=(string) $config['command_bus']['service_id']; |
|
| 53 | 53 | if ($commandBusId === 'eps.req2cmd.command_bus.tactician') { |
| 54 | - $busName = (string)$config['command_bus']['name']; |
|
| 55 | - $tacticianServiceName = 'tactician.commandbus.' . $busName; |
|
| 56 | - $busDefinition = $container->findDefinition('eps.req2cmd.command_bus.tactician'); |
|
| 54 | + $busName=(string) $config['command_bus']['name']; |
|
| 55 | + $tacticianServiceName='tactician.commandbus.'.$busName; |
|
| 56 | + $busDefinition=$container->findDefinition('eps.req2cmd.command_bus.tactician'); |
|
| 57 | 57 | $busDefinition->replaceArgument(0, new Reference($tacticianServiceName)); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -62,24 +62,24 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | private function configureEventListeners(array $config, ContainerBuilder $container): void |
| 64 | 64 | { |
| 65 | - $listenersMap = [ |
|
| 65 | + $listenersMap=[ |
|
| 66 | 66 | 'extractor' => 'eps.req2cmd.listener.extract_command' |
| 67 | 67 | ]; |
| 68 | - foreach ((array)$config['listeners'] as $listenerName => $listenerConfig) { |
|
| 69 | - $listenerId = $listenersMap[$listenerName]; |
|
| 68 | + foreach ((array) $config['listeners'] as $listenerName => $listenerConfig) { |
|
| 69 | + $listenerId=$listenersMap[$listenerName]; |
|
| 70 | 70 | if (!$listenerConfig['enabled']) { |
| 71 | 71 | $container->removeDefinition($listenerId); |
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | - $definition = $container->findDefinition($listenerId); |
|
| 75 | - $serviceTags = $definition->getTags(); |
|
| 74 | + $definition=$container->findDefinition($listenerId); |
|
| 75 | + $serviceTags=$definition->getTags(); |
|
| 76 | 76 | foreach ($serviceTags as $tagName => $tags) { |
| 77 | 77 | if ($tagName !== 'kernel.event_listener') { |
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | foreach ($tags as $tagIdx => $tag) { |
| 82 | - $serviceTags[$tagName][$tagIdx]['priority'] = $listenerConfig['priority']; |
|
| 82 | + $serviceTags[$tagName][$tagIdx]['priority']=$listenerConfig['priority']; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | $definition->setTags($serviceTags); |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function getConfigTreeBuilder(): TreeBuilder |
| 17 | 17 | { |
| 18 | - $builder = new TreeBuilder(); |
|
| 18 | + $builder=new TreeBuilder(); |
|
| 19 | 19 | |
| 20 | - $root = $builder->root('req2cmd'); |
|
| 20 | + $root=$builder->root('req2cmd'); |
|
| 21 | 21 | $root |
| 22 | 22 | ->children() |
| 23 | 23 | ->append($this->addExtractorNode()) |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | private function addExtractorNode(): NodeDefinition |
| 32 | 32 | { |
| 33 | - $builder = new TreeBuilder(); |
|
| 34 | - $root = $builder->root('extractor'); |
|
| 33 | + $builder=new TreeBuilder(); |
|
| 34 | + $root=$builder->root('extractor'); |
|
| 35 | 35 | $root |
| 36 | 36 | ->addDefaultsIfNotSet() |
| 37 | 37 | ->beforeNormalization() |
| 38 | 38 | ->ifString() |
| 39 | - ->then(function ($extractorName) { |
|
| 40 | - return ['service_id' => 'eps.req2cmd.extractor.' . $extractorName]; |
|
| 39 | + ->then(function($extractorName) { |
|
| 40 | + return ['service_id' => 'eps.req2cmd.extractor.'.$extractorName]; |
|
| 41 | 41 | }) |
| 42 | 42 | ->end() |
| 43 | 43 | ->children() |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private function addCommandBusNode(): NodeDefinition |
| 54 | 54 | { |
| 55 | - $builder = new TreeBuilder(); |
|
| 56 | - $node = $builder->root('command_bus'); |
|
| 55 | + $builder=new TreeBuilder(); |
|
| 56 | + $node=$builder->root('command_bus'); |
|
| 57 | 57 | $node |
| 58 | 58 | ->addDefaultsIfNotSet() |
| 59 | 59 | ->beforeNormalization() |
| 60 | 60 | ->ifString() |
| 61 | - ->then(function (string $svcId) { |
|
| 62 | - return ['service_id' => 'eps.req2cmd.command_bus.' . $svcId]; |
|
| 61 | + ->then(function(string $svcId) { |
|
| 62 | + return ['service_id' => 'eps.req2cmd.command_bus.'.$svcId]; |
|
| 63 | 63 | }) |
| 64 | 64 | ->end() |
| 65 | 65 | ->children() |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | ->end() |
| 74 | 74 | ->end() |
| 75 | 75 | ->validate() |
| 76 | - ->ifTrue(function ($config) { |
|
| 76 | + ->ifTrue(function($config) { |
|
| 77 | 77 | return $config['service_id'] !== 'eps.req2cmd.command_bus.tactician'; |
| 78 | 78 | }) |
| 79 | - ->then(function ($config) { |
|
| 79 | + ->then(function($config) { |
|
| 80 | 80 | unset($config['name']); |
| 81 | 81 | return $config; |
| 82 | 82 | }) |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | private function addEventListenersNode(): NodeDefinition |
| 89 | 89 | { |
| 90 | - $builder = new TreeBuilder(); |
|
| 91 | - $node = $builder->root('listeners'); |
|
| 90 | + $builder=new TreeBuilder(); |
|
| 91 | + $node=$builder->root('listeners'); |
|
| 92 | 92 | |
| 93 | 93 | $node |
| 94 | 94 | ->addDefaultsIfNotSet() |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | ->arrayNode('extractor') |
| 97 | 97 | ->addDefaultsIfNotSet() |
| 98 | 98 | ->beforeNormalization() |
| 99 | - ->ifTrue(function ($enabled) { return is_bool($enabled); }) |
|
| 100 | - ->then(function ($isEnabled) { |
|
| 99 | + ->ifTrue(function($enabled) { return is_bool($enabled); }) |
|
| 100 | + ->then(function($isEnabled) { |
|
| 101 | 101 | return ['enabled' => $isEnabled]; |
| 102 | 102 | }) |
| 103 | 103 | ->end() |