Completed
Push — master ( d50c89...6b8eda )
by Andrey
01:55
created
src/ListenerQueue.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@
 block discarded – undo
55 55
      */
56 56
     public function valid()
57 57
     {
58
-        if(sizeof($this->listeners) == 0)
59
-            return false;
58
+        if(sizeof($this->listeners) == 0) {
59
+                    return false;
60
+        }
60 61
 
61 62
         return true;
62 63
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
     public function eject(callable $callback)
35 35
     {
36 36
         $flag = false;
37
-        foreach($this->listeners as $key => $value)
37
+        foreach ($this->listeners as $key => $value)
38 38
         {
39 39
             $finded = in_array($callback, $value, true);
40
-            if($finded)
40
+            if ($finded)
41 41
             {
42 42
                 unset($this->listeners[$key]);
43
-                $flag =  true;
43
+                $flag = true;
44 44
             }
45 45
         }
46 46
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function valid()
57 57
     {
58
-        if(sizeof($this->listeners) == 0)
58
+        if (sizeof($this->listeners) == 0)
59 59
             return false;
60 60
 
61 61
         return true;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function lsort()
90 90
     {
91
-        uasort($this->listeners, function($a, $b){
91
+        uasort($this->listeners, function($a, $b) {
92 92
             if ($a['priority'] == $b['priority']) {
93 93
                 return 0;
94 94
             }
Please login to merge, or discard this patch.
src/EventManager.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function attach($event, $callback, $priority = 0)
21 21
     {
22
-        if(!is_string($event) && !is_callable($callback) && !is_integer($priority))
22
+        if (!is_string($event) && !is_callable($callback) && !is_integer($priority))
23 23
         {
24 24
             return false;
25 25
         }
26 26
 
27
-        if(!array_key_exists($event, $this->events))
27
+        if (!array_key_exists($event, $this->events))
28 28
             $this->events[$event] = new ListenerQueue;
29 29
 
30 30
         $this->events[$event]->add($callback, $priority);
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function detach($event, $callback)
41 41
     {
42
-        if(!is_string($event) && !is_callable($callback))
42
+        if (!is_string($event) && !is_callable($callback))
43 43
         {
44 44
             return false;
45 45
         }
46 46
 
47
-        if(array_key_exists($event, $this->events))
47
+        if (array_key_exists($event, $this->events))
48 48
         {
49 49
             $this->events[$event]->eject($callback);
50 50
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function clearListeners($event)
62 62
     {
63
-        if(!is_string($event))
63
+        if (!is_string($event))
64 64
         {
65 65
             return false;
66 66
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function trigger($event, $target = null, $argv = [])
82 82
     {
83
-        if((
83
+        if ((
84 84
                 !is_string($event) && !is_object($event)
85 85
             ) && (
86 86
                 !is_string($target) && !is_object($target)
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
             return false;
92 92
         }
93 93
 
94
-        if($event instanceof EventInterface)
94
+        if ($event instanceof EventInterface)
95 95
         {
96 96
             $event = $event->getName();
97 97
         }
98 98
 
99 99
         $event = $this->events[$event];
100 100
 
101
-        while($event->valid())
101
+        while ($event->valid())
102 102
         {
103 103
             call_user_func_array(
104 104
                 $event->top(), 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@
 block discarded – undo
24 24
             return false;
25 25
         }
26 26
 
27
-        if(!array_key_exists($event, $this->events))
28
-            $this->events[$event] = new ListenerQueue;
27
+        if(!array_key_exists($event, $this->events)) {
28
+                    $this->events[$event] = new ListenerQueue;
29
+        }
29 30
 
30 31
         $this->events[$event]->add($callback, $priority);
31 32
     }
Please login to merge, or discard this patch.