Passed
Pull Request — v7 (#595)
by
unknown
01:53
created
lib/Phpfastcache/EventManager.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache;
17 17
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
          * due to performance issue on huge
77 77
          * loop dispatching operations
78 78
          */
79
-        if (isset($this->events[ $eventName ])) {
80
-            foreach ($this->events[ $eventName ] as $event) {
79
+        if (isset($this->events[$eventName])) {
80
+            foreach ($this->events[$eventName] as $event) {
81 81
                 call_user_func_array($event, $args);
82 82
             }
83 83
         }
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
     {
94 94
         if (\strpos($name, 'on') === 0) {
95 95
             $name = \substr($name, 2);
96
-            if (\is_callable($arguments[ 0 ])) {
97
-                if (isset($arguments[ 1 ]) && \is_string($arguments[ 0 ])) {
98
-                    $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ];
96
+            if (\is_callable($arguments[0])) {
97
+                if (isset($arguments[1]) && \is_string($arguments[0])) {
98
+                    $this->events[$name][$arguments[1]] = $arguments[0];
99 99
                 } else {
100
-                    $this->events[ $name ][] = $arguments[ 0 ];
100
+                    $this->events[$name][] = $arguments[0];
101 101
                 }
102 102
             } else {
103
-                throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[ 0 ])));
103
+                throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[0])));
104 104
             }
105 105
         } else {
106 106
             throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"');
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function unbindEventCallback(string $eventName, string $callbackName): bool
116 116
     {
117
-        $return = isset($this->events[ $eventName ][ $callbackName ]);
118
-        unset($this->events[ $eventName ][ $callbackName ]);
117
+        $return = isset($this->events[$eventName][$callbackName]);
118
+        unset($this->events[$eventName][$callbackName]);
119 119
 
120 120
         return $return;
121 121
     }
Please login to merge, or discard this patch.