@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | protected function _handle(EventInterface $event, int $depthLevelCount = 0) |
| 80 | 80 | { |
| 81 | - if($this->maxDepthLevelCount !== null && $depthLevelCount >= $this->maxDepthLevelCount) { |
|
| 81 | + if ($this->maxDepthLevelCount !== null && $depthLevelCount >= $this->maxDepthLevelCount) { |
|
| 82 | 82 | throw new EventRouterException( |
| 83 | 83 | 'max depth level reached', |
| 84 | 84 | EventRouterException::MAX_DEPTH_LEVEL_REACHED, |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - foreach($this->map->get($event) as $handler) { |
|
| 90 | + foreach ($this->map->get($event) as $handler) { |
|
| 91 | 91 | $result = $handler($event); |
| 92 | 92 | $this->logger->append($event); |
| 93 | 93 | |
| 94 | - if($result instanceof EventInterface) { |
|
| 94 | + if ($result instanceof EventInterface) { |
|
| 95 | 95 | $this->_handle($result, ++$depthLevelCount); |
| 96 | - } elseif(is_array($result)) { |
|
| 97 | - foreach($result as $item) { |
|
| 98 | - if($item instanceof EventInterface) { |
|
| 96 | + } elseif (is_array($result)) { |
|
| 97 | + foreach ($result as $item) { |
|
| 98 | + if ($item instanceof EventInterface) { |
|
| 99 | 99 | $this->_handle($item, ++$depthLevelCount); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -31,16 +31,16 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | [$origin, $name] = [$config->getOrigin(), $config->getName()]; |
| 33 | 33 | |
| 34 | - if($name === null) { |
|
| 35 | - if(!isset($this->originMap[$origin])) { |
|
| 34 | + if ($name === null) { |
|
| 35 | + if (!isset($this->originMap[$origin])) { |
|
| 36 | 36 | $this->originNameMap[$origin] = []; |
| 37 | 37 | } |
| 38 | 38 | $this->originMap[$origin][] = [$config, $handler]; |
| 39 | 39 | } else { |
| 40 | - if(!isset($this->originNameMap[$origin])) { |
|
| 40 | + if (!isset($this->originNameMap[$origin])) { |
|
| 41 | 41 | $this->originNameMap[$origin] = []; |
| 42 | 42 | } |
| 43 | - if(!isset($this->originNameMap[$origin][$name])) { |
|
| 43 | + if (!isset($this->originNameMap[$origin][$name])) { |
|
| 44 | 44 | $this->originNameMap[$origin][$name] = []; |
| 45 | 45 | } |
| 46 | 46 | $this->originNameMap[$origin][$name][] = [$config, $handler]; |
@@ -60,21 +60,21 @@ discard block |
||
| 60 | 60 | * @var EventConfigInterface $config |
| 61 | 61 | * @var callable $handler |
| 62 | 62 | */ |
| 63 | - foreach($this->originMap[$event->getOrigin()] ?? [] as [$config, $handler]) { |
|
| 64 | - if(!$this->hasRecipientsIntersection($config, $event)) { |
|
| 63 | + foreach ($this->originMap[$event->getOrigin()] ?? [] as [$config, $handler]) { |
|
| 64 | + if (!$this->hasRecipientsIntersection($config, $event)) { |
|
| 65 | 65 | continue; |
| 66 | 66 | } |
| 67 | - if(!$this->applyExtraFilter($config, $event)) { |
|
| 67 | + if (!$this->applyExtraFilter($config, $event)) { |
|
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | $handlers[] = $handler; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - foreach($this->originNameMap[$event->getOrigin()][$event->getName()] ?? [] as [$config, $handler]) { |
|
| 74 | - if(!$this->hasRecipientsIntersection($config, $event)) { |
|
| 73 | + foreach ($this->originNameMap[$event->getOrigin()][$event->getName()] ?? [] as [$config, $handler]) { |
|
| 74 | + if (!$this->hasRecipientsIntersection($config, $event)) { |
|
| 75 | 75 | continue; |
| 76 | 76 | } |
| 77 | - if(!$this->applyExtraFilter($config, $event)) { |
|
| 77 | + if (!$this->applyExtraFilter($config, $event)) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | $handlers[] = $handler; |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $candidates = $config->getRecipients(); |
| 95 | 95 | |
| 96 | - if($candidates === null) { |
|
| 96 | + if ($candidates === null) { |
|
| 97 | 97 | return true; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $recipients = $event->getRecipients(); |
| 101 | 101 | |
| 102 | - return (bool)count(array_intersect($candidates, $recipients)); |
|
| 102 | + return (bool) count(array_intersect($candidates, $recipients)); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |