Passed
Branch master (ed996e)
by Smoren
11:59
created
Category
src/Components/EventRouterMap.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
     {
26 26
         [$origin, $name] = [$config->getOrigin(), $config->getName()];
27 27
 
28
-        if($name === null) {
29
-            if(!isset($this->originMap[$origin])) {
28
+        if ($name === null) {
29
+            if (!isset($this->originMap[$origin])) {
30 30
                 $this->originNameMap[$origin] = [];
31 31
             }
32 32
             $this->originMap[$origin][] = [$config, $handler];
33 33
         } else {
34
-            if(!isset($this->originNameMap[$origin])) {
34
+            if (!isset($this->originNameMap[$origin])) {
35 35
                 $this->originNameMap[$origin] = [];
36 36
             }
37
-            if(!isset($this->originNameMap[$origin][$name])) {
37
+            if (!isset($this->originNameMap[$origin][$name])) {
38 38
                 $this->originNameMap[$origin][$name] = [];
39 39
             }
40 40
             $this->originNameMap[$origin][$name][] = [$config, $handler];
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
          * @var EventConfigInterface $config
54 54
          * @var callable $handler
55 55
          */
56
-        foreach($this->originMap[$event->getOrigin()] ?? [] as [$config, $handler]) {
57
-            if(!$this->hasRecipientsIntersection($config, $event)) {
56
+        foreach ($this->originMap[$event->getOrigin()] ?? [] as [$config, $handler]) {
57
+            if (!$this->hasRecipientsIntersection($config, $event)) {
58 58
                 continue;
59 59
             }
60
-            if(!$this->applyExtraFilter($config, $event)) {
60
+            if (!$this->applyExtraFilter($config, $event)) {
61 61
                 continue;
62 62
             }
63 63
             $handlers[] = $handler;
64 64
         }
65 65
 
66
-        foreach($this->originNameMap[$event->getOrigin()][$event->getName()] ?? [] as [$config, $handler]) {
67
-            if(!$this->hasRecipientsIntersection($config, $event)) {
66
+        foreach ($this->originNameMap[$event->getOrigin()][$event->getName()] ?? [] as [$config, $handler]) {
67
+            if (!$this->hasRecipientsIntersection($config, $event)) {
68 68
                 continue;
69 69
             }
70
-            if(!$this->applyExtraFilter($config, $event)) {
70
+            if (!$this->applyExtraFilter($config, $event)) {
71 71
                 continue;
72 72
             }
73 73
             $handlers[] = $handler;
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $candidates = $config->getRecipients();
82 82
 
83
-        if($candidates === null) {
83
+        if ($candidates === null) {
84 84
             return true;
85 85
         }
86 86
 
87 87
         $recipients = $event->getRecipients();
88 88
 
89
-        return (bool)count(array_intersect($candidates, $recipients));
89
+        return (bool) count(array_intersect($candidates, $recipients));
90 90
     }
91 91
 
92 92
     protected function applyExtraFilter(EventConfigInterface $config, EventInterface $event): bool
Please login to merge, or discard this patch.
src/Components/EventRouter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.