@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect |
19 | 19 | * @return |
20 | 20 | */ |
21 | - public function connect($name, $listener){ |
|
21 | + public function connect($name, $listener) { |
|
22 | 22 | $name = is_object($name) ? get_class($name) : (string)$name; |
23 | - if(Test::assertClassOrInterfaceExists($name)){ |
|
23 | + if (Test::assertClassOrInterfaceExists($name)) { |
|
24 | 24 | parent::connect($name, $listener); |
25 | - }else{ |
|
25 | + }else { |
|
26 | 26 | throw new \InvalidArgumentException($name." is not an Class nor Interface"); |
27 | 27 | } |
28 | 28 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | * @param mixed $subject the subject |
36 | 36 | * @return |
37 | 37 | */ |
38 | - public function notify($name, $subject){ |
|
38 | + public function notify($name, $subject) { |
|
39 | 39 | $res = false; |
40 | - foreach(Reflection::getImplementedClassesAndInterfaces($name) as $cls){ |
|
41 | - if(parent::hasListeners($cls)){ |
|
40 | + foreach (Reflection::getImplementedClassesAndInterfaces($name) as $cls) { |
|
41 | + if (parent::hasListeners($cls)) { |
|
42 | 42 | self::doNotify($this->getListeners($cls), $subject); |
43 | 43 | $res = true; |
44 | 44 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * @param mixed $subject the subject |
57 | 57 | * @return \PEIP\INF\Handler\Handler listener which returned a boolean true value |
58 | 58 | */ |
59 | - public function notifyUntil($name, $subject){ |
|
59 | + public function notifyUntil($name, $subject) { |
|
60 | 60 | $res = NULL; |
61 | - foreach(Reflection::getImplementedClassesAndInterfaces($name) as $cls){ |
|
62 | - if(!$res && parent::hasListeners($cls)){ |
|
61 | + foreach (Reflection::getImplementedClassesAndInterfaces($name) as $cls) { |
|
62 | + if (!$res && parent::hasListeners($cls)) { |
|
63 | 63 | $res = self::doNotifyUntil($this->getListeners($cls), $subject); |
64 | 64 | } |
65 | 65 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param mixed $subject the subject |
76 | 76 | * @return |
77 | 77 | */ |
78 | - public function notifyOfInstance($subject){ |
|
78 | + public function notifyOfInstance($subject) { |
|
79 | 79 | |
80 | 80 | return $this->notify(get_class($subject), $subject); |
81 | 81 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @param string $name name of the event |
87 | 87 | * @return boolean wether any listener is registered for event-name |
88 | 88 | */ |
89 | - public function hasListeners($name){ |
|
90 | - foreach(Reflection::getImplementedClassesAndInterfaces($name) as $cls){ |
|
91 | - if(parent::hasListeners($cls)){ |
|
89 | + public function hasListeners($name) { |
|
90 | + foreach (Reflection::getImplementedClassesAndInterfaces($name) as $cls) { |
|
91 | + if (parent::hasListeners($cls)) { |
|
92 | 92 | return true; |
93 | 93 | } |
94 | 94 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param Callable|PEIP\INF\Handler\Handler $listener |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function connect($listener){ |
|
43 | + public function connect($listener) { |
|
44 | 44 | Test::ensureHandler($listener); |
45 | 45 | $this->listeners[] = $listener; |
46 | 46 | } |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * @param Callable|PEIP\INF\Handler\Handler $listener |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function disconnect($listener){ |
|
55 | + public function disconnect($listener) { |
|
56 | 56 | Test::ensureHandler($listener); |
57 | - foreach ($this->listeners as $i => $callable){ |
|
58 | - if ($listener === $callable){ |
|
57 | + foreach ($this->listeners as $i => $callable) { |
|
58 | + if ($listener === $callable) { |
|
59 | 59 | unset($this->listeners[$i]); |
60 | 60 | } |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param Callable|PEIP\INF\Handler\Handler $listener |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function disconnectAll(){ |
|
71 | + public function disconnectAll() { |
|
72 | 72 | $this->listeners = array(); |
73 | 73 | } |
74 | 74 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @access public |
79 | 79 | * @return boolean wether any listeners are registered |
80 | 80 | */ |
81 | - public function hasListeners(){ |
|
82 | - return (boolean) count($this->listeners); |
|
81 | + public function hasListeners() { |
|
82 | + return (boolean)count($this->listeners); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | * @param mixed $subject the subject |
90 | 90 | * @return void |
91 | 91 | */ |
92 | - public function notify($subject){ |
|
92 | + public function notify($subject) { |
|
93 | 93 | $res = NULL; |
94 | - if($this->hasListeners()){ |
|
94 | + if ($this->hasListeners()) { |
|
95 | 95 | $res = self::doNotify($this->getListeners(), $subject); |
96 | 96 | } |
97 | 97 | return $res; |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param mixed $subject the subject |
105 | 105 | * @return \PEIP\INF\Handler\Handler the listener which returned a boolean true value |
106 | 106 | */ |
107 | - public function notifyUntil($subject){ |
|
108 | - if($this->hasListeners()){ |
|
107 | + public function notifyUntil($subject) { |
|
108 | + if ($this->hasListeners()) { |
|
109 | 109 | $res = self::doNotifyUntil($this->getListeners(), $subject); |
110 | 110 | } |
111 | 111 | return $res; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @access public |
118 | 118 | * @return array the listeners |
119 | 119 | */ |
120 | - public function getListeners(){ |
|
120 | + public function getListeners() { |
|
121 | 121 | return $this->listeners; |
122 | 122 | } |
123 | 123 |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | * @param \PEIP\INF\Event\Event $object an event object |
41 | 41 | * @return boolean |
42 | 42 | */ |
43 | - public function notify($name, $object){ |
|
44 | - if($object instanceof \PEIP\INF\Event\Event){ |
|
45 | - if(is_object($object->getContent())){ |
|
46 | - if($this->hasListeners($name, $object->getContent())){ |
|
43 | + public function notify($name, $object) { |
|
44 | + if ($object instanceof \PEIP\INF\Event\Event) { |
|
45 | + if (is_object($object->getContent())) { |
|
46 | + if ($this->hasListeners($name, $object->getContent())) { |
|
47 | 47 | return self::doNotify($this->getListeners($name, $object->getContent()), $object); |
48 | 48 | } |
49 | - }else{ |
|
49 | + }else { |
|
50 | 50 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
51 | 51 | } |
52 | - }else{ |
|
52 | + }else { |
|
53 | 53 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
54 | 54 | } |
55 | 55 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @return |
67 | 67 | * @see EventBuilder |
68 | 68 | */ |
69 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){ |
|
70 | - if(!$this->hasListeners($name, $object)){ |
|
69 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
|
70 | + if (!$this->hasListeners($name, $object)) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | $event = EventBuilder::getInstance($eventClass)->build( |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | * @param Callable|PEIP\INF\Handler\Handler $listener event-handler |
44 | 44 | * @return boolean |
45 | 45 | */ |
46 | - public function connect($name, $object, $listener){ |
|
46 | + public function connect($name, $object, $listener) { |
|
47 | 47 | Test::ensureHandler($listener); |
48 | 48 | $listners = $this->doGetListeners(); |
49 | - if (!$this->listeners->contains($object)){ |
|
49 | + if (!$this->listeners->contains($object)) { |
|
50 | 50 | $this->listeners->attach($object, new \ArrayObject); |
51 | 51 | } |
52 | - if (!array_key_exists($name, $listners[$object])){ |
|
52 | + if (!array_key_exists($name, $listners[$object])) { |
|
53 | 53 | $this->listeners[$object][$name] = array(); |
54 | 54 | } |
55 | 55 | $hash = $this->getListenerHash($listener); |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | * @param \PEIP\INF\Handler\Handler $listener event-handler |
68 | 68 | * @return boolean |
69 | 69 | */ |
70 | - public function disconnect($name, $object, $listener){ |
|
70 | + public function disconnect($name, $object, $listener) { |
|
71 | 71 | $listners = $this->doGetListeners(); |
72 | - if (!$listners->contains($object) || !isset($listners[$object][$name])){ |
|
72 | + if (!$listners->contains($object) || !isset($listners[$object][$name])) { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | $eventListeners = $listners[$object][$name]; |
76 | 76 | $hash = $this->getListenerHash($listener); |
77 | - if(isset($eventListeners[$hash])){ |
|
77 | + if (isset($eventListeners[$hash])) { |
|
78 | 78 | unset($eventListeners[$hash]); |
79 | 79 | |
80 | 80 | $listners[$object][$name] = $eventListeners; |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | |
86 | - public function disconnectAll($name, $object){ |
|
87 | - if(is_object($object)){ |
|
86 | + public function disconnectAll($name, $object) { |
|
87 | + if (is_object($object)) { |
|
88 | 88 | $listners = $this->doGetListeners(); |
89 | - if($listners && $this->hadListeners($name, $object)){ |
|
89 | + if ($listners && $this->hadListeners($name, $object)) { |
|
90 | 90 | $listners[$object][$name] = array(); |
91 | 91 | } |
92 | 92 | } |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | * @param object $object object to check for listeners |
101 | 101 | * @return boolean |
102 | 102 | */ |
103 | - public function hasListeners($name, $object){ |
|
103 | + public function hasListeners($name, $object) { |
|
104 | 104 | $listners = $this->doGetListeners(); |
105 | - if (!$this->hadListeners($name, $object)){ |
|
105 | + if (!$this->hadListeners($name, $object)) { |
|
106 | 106 | $res = false; |
107 | - }else{ |
|
107 | + }else { |
|
108 | 108 | $listners = $this->doGetListeners(); |
109 | - $res = (boolean) count($listners[$object][$name]); |
|
109 | + $res = (boolean)count($listners[$object][$name]); |
|
110 | 110 | } |
111 | 111 | return $res; |
112 | 112 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param object $object object to check for listeners |
120 | 120 | * @return boolean |
121 | 121 | */ |
122 | - public function hadListeners($name, $object){ |
|
122 | + public function hadListeners($name, $object) { |
|
123 | 123 | $listners = $this->doGetListeners(); |
124 | 124 | return ($listners->contains($object) && isset($listners[$object][$name])) ? true : false; |
125 | 125 | } |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * @param object $object object to get event-names for |
132 | 132 | * @return string[] array of event-names |
133 | 133 | */ |
134 | - public function getEventNames($object){ |
|
134 | + public function getEventNames($object) { |
|
135 | 135 | $listeners = $this->doGetListeners(); |
136 | - if (!$listeners->contains($object)){ |
|
136 | + if (!$listeners->contains($object)) { |
|
137 | 137 | return array(); |
138 | 138 | } |
139 | 139 | return array_keys($listeners[$object]->getArrayCopy()); |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param $object |
148 | 148 | * @return boolean |
149 | 149 | */ |
150 | - public function notify($name, $object){ |
|
151 | - if($this->hasListeners($name, $object)){ |
|
150 | + public function notify($name, $object) { |
|
151 | + if ($this->hasListeners($name, $object)) { |
|
152 | 152 | $listners = $this->doGetListeners(); |
153 | 153 | self::doNotify($listners[$object][$name], $object); |
154 | 154 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | * @param $subject |
165 | 165 | * @return mixed |
166 | 166 | */ |
167 | - public function notifyUntil($name, $subject){ |
|
168 | - if($this->hasListeners($name, $subject)){ |
|
167 | + public function notifyUntil($name, $subject) { |
|
168 | + if ($this->hasListeners($name, $subject)) { |
|
169 | 169 | $res = self::doNotifyUntil($this->getListeners($name, $subject), $subject); |
170 | 170 | } |
171 | 171 | return $res; |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @param object $object object to check for listeners |
180 | 180 | * @return array array of listeners |
181 | 181 | */ |
182 | - public function getListeners($name, $object){ |
|
183 | - if (!$this->hadListeners($name, $object)){ |
|
182 | + public function getListeners($name, $object) { |
|
183 | + if (!$this->hadListeners($name, $object)) { |
|
184 | 184 | return array(); |
185 | 185 | } |
186 | 186 | $listeners = $this->listeners[$object]->getArrayCopy(); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @access protected |
195 | 195 | * @return ObjectStorage |
196 | 196 | */ |
197 | - protected function doGetListeners(){ |
|
197 | + protected function doGetListeners() { |
|
198 | 198 | return isset($this->listeners) ? $this->listeners : $this->listeners = new ObjectStorage(); |
199 | 199 | } |
200 | 200 | |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | * @param $object |
208 | 208 | * @return boolean |
209 | 209 | */ |
210 | - protected static function doNotify(array $listeners, $subject){ |
|
211 | - foreach($listeners as $listener){ |
|
212 | - if($listener instanceof \PEIP\INF\Handler\Handler){ |
|
210 | + protected static function doNotify(array $listeners, $subject) { |
|
211 | + foreach ($listeners as $listener) { |
|
212 | + if ($listener instanceof \PEIP\INF\Handler\Handler) { |
|
213 | 213 | $listener->handle($subject); |
214 | - }elseif(is_callable($listener)){ |
|
214 | + }elseif (is_callable($listener)) { |
|
215 | 215 | call_user_func($listener, $subject); |
216 | 216 | } |
217 | 217 | } |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | * @param $object |
227 | 227 | * @return \PEIP\INF\Handler\Handler the listener which returned a boolean true value |
228 | 228 | */ |
229 | - protected static function doNotifyUntil(array $listeners, $subject){ |
|
229 | + protected static function doNotifyUntil(array $listeners, $subject) { |
|
230 | 230 | $res = NULL; |
231 | - foreach ($listeners as $listener){ |
|
232 | - if($listener instanceof \PEIP\INF\Handler\Handler){ |
|
231 | + foreach ($listeners as $listener) { |
|
232 | + if ($listener instanceof \PEIP\INF\Handler\Handler) { |
|
233 | 233 | $res = $listener->handle($subject); |
234 | - if ($res){ |
|
234 | + if ($res) { |
|
235 | 235 | return $listener; |
236 | 236 | } |
237 | 237 | } |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | return $res; |
240 | 240 | } |
241 | 241 | |
242 | - protected function getListenerHash($listener){ |
|
243 | - if(!is_object($listener)){ |
|
242 | + protected function getListenerHash($listener) { |
|
243 | + if (!is_object($listener)) { |
|
244 | 244 | $o = new \stdClass(); |
245 | 245 | $o->listener = $listener; |
246 | 246 | $listener = $o; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * @param \PEIP\INF\Event\Event $object an event object |
26 | 26 | * @return boolean |
27 | 27 | */ |
28 | - public function notify($name, $object){ |
|
29 | - if($object instanceof \PEIP\INF\Event\Event){ |
|
30 | - if(is_object($object->getContent())){ |
|
28 | + public function notify($name, $object) { |
|
29 | + if ($object instanceof \PEIP\INF\Event\Event) { |
|
30 | + if (is_object($object->getContent())) { |
|
31 | 31 | return self::doNotify( |
32 | 32 | $this->getListeners( |
33 | 33 | $name, |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | ), |
36 | 36 | $object->getContent() |
37 | 37 | ); |
38 | - }else{ |
|
38 | + }else { |
|
39 | 39 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
40 | 40 | } |
41 | - }else{ |
|
41 | + }else { |
|
42 | 42 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
43 | 43 | } |
44 | 44 | } //put your code here |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @return |
56 | 56 | * @see EventBuilder |
57 | 57 | */ |
58 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){ |
|
59 | - if(!$this->hasListeners($name, ($object))){ |
|
58 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
|
59 | + if (!$this->hasListeners($name, ($object))) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param object $object object to check for listeners |
80 | 80 | * @return boolean |
81 | 81 | */ |
82 | - public function hasListeners($name, $object){ |
|
82 | + public function hasListeners($name, $object) { |
|
83 | 83 | return parent::hasListeners( |
84 | 84 | $name, |
85 | 85 | ReflectionPool::getInstance($object) |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @param Callable|PEIP\INF\Handler\Handler $listener event-handler |
28 | 28 | * @return boolean |
29 | 29 | */ |
30 | - public function connect($name, $object, $listener){ |
|
30 | + public function connect($name, $object, $listener) { |
|
31 | 31 | $class = is_object($object) ? get_class($object) : (string)$object; |
32 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){ |
|
32 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) { |
|
33 | 33 | $reflection = Reflection_Pool::getInstance($class); |
34 | 34 | parent::connect($name, $reflection, $listener); |
35 | 35 | } |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return true; |
38 | 38 | } |
39 | 39 | |
40 | - public function disconnect($name, $object, $listener){ |
|
40 | + public function disconnect($name, $object, $listener) { |
|
41 | 41 | $class = is_object($object) ? get_class($object) : (string)$object; |
42 | 42 | $res = true; |
43 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){ |
|
43 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) { |
|
44 | 44 | $reflection = Reflection_Pool::getInstance($class); |
45 | 45 | $r = parent::disconnect($name, $reflection, $listener); |
46 | - if(!$r){ |
|
46 | + if (!$r) { |
|
47 | 47 | $res = false; |
48 | 48 | } |
49 | 49 | } |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @param \PEIP\INF\Event\Event $object an event object |
59 | 59 | * @return boolean |
60 | 60 | */ |
61 | - public function notify($name, $object){ |
|
62 | - if($object instanceof \PEIP\INF\Event\Event){ |
|
63 | - if(is_object($object->getContent())){ |
|
61 | + public function notify($name, $object) { |
|
62 | + if ($object instanceof \PEIP\INF\Event\Event) { |
|
63 | + if (is_object($object->getContent())) { |
|
64 | 64 | return self::doNotify( |
65 | 65 | $this->getListeners( |
66 | 66 | $name, |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | ), |
71 | 71 | $object |
72 | 72 | ); |
73 | - }else{ |
|
73 | + }else { |
|
74 | 74 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
75 | 75 | } |
76 | - }else{ |
|
76 | + }else { |
|
77 | 77 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
78 | 78 | } |
79 | 79 | } //put your code here |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @return |
91 | 91 | * @see EventBuilder |
92 | 92 | */ |
93 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){ |
|
94 | - if(!$this->hasListeners($name, ($object))){ |
|
93 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
|
94 | + if (!$this->hasListeners($name, ($object))) { |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param object $object object to check for listeners |
115 | 115 | * @return boolean |
116 | 116 | */ |
117 | - public function hasListeners($name, $object){ |
|
117 | + public function hasListeners($name, $object) { |
|
118 | 118 | return parent::hasListeners( |
119 | 119 | $name, |
120 | 120 | Reflection_Pool::getInstance($object) |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * @param mixed array|ArrayAccess array with values to iterate over |
42 | 42 | * @return |
43 | 43 | */ |
44 | - public function __construct($array = array()){ |
|
44 | + public function __construct($array = array()) { |
|
45 | 45 | $this->init($array); |
46 | 46 | } |
47 | 47 | |
48 | - protected function init($array = array()){ |
|
48 | + protected function init($array = array()) { |
|
49 | 49 | $array = Test::assertArrayAccess($array) |
50 | 50 | ? $array |
51 | 51 | : array(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param mixed $listener the listener to register |
60 | 60 | * @return |
61 | 61 | */ |
62 | - public function connect($listener){ |
|
62 | + public function connect($listener) { |
|
63 | 63 | $this->listeners[] = $listener; |
64 | 64 | } |
65 | 65 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @param mixed $listener the listener to unregister |
71 | 71 | * @return |
72 | 72 | */ |
73 | - public function disconnect($listener){ |
|
74 | - foreach ($this->listeners as $i => $callable){ |
|
75 | - if ($listener === $callable){ |
|
73 | + public function disconnect($listener) { |
|
74 | + foreach ($this->listeners as $i => $callable) { |
|
75 | + if ($listener === $callable) { |
|
76 | 76 | unset($this->listeners[$i]); |
77 | 77 | } |
78 | 78 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @access public |
86 | 86 | * @return |
87 | 87 | */ |
88 | - public function disconnectAll(){ |
|
88 | + public function disconnectAll() { |
|
89 | 89 | $this->init(); |
90 | 90 | } |
91 | 91 | |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * @access public |
96 | 96 | * @return boolean wether any listener is registered |
97 | 97 | */ |
98 | - public function hasListeners(){ |
|
99 | - return (boolean) $this->listeners->count(); |
|
98 | + public function hasListeners() { |
|
99 | + return (boolean)$this->listeners->count(); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * @param mixed $subject the subject to notify about |
109 | 109 | * @return |
110 | 110 | */ |
111 | - public function notify($subject){ |
|
111 | + public function notify($subject) { |
|
112 | 112 | $res = NULL; |
113 | - if($this->hasListeners()){ |
|
114 | - if(!$this->listeners->valid()){ |
|
113 | + if ($this->hasListeners()) { |
|
114 | + if (!$this->listeners->valid()) { |
|
115 | 115 | $this->listeners->rewind(); |
116 | 116 | } |
117 | 117 | $res = self::doNotifyOne($this->listeners->current(), $subject); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @return array registered listeners |
128 | 128 | */ |
129 | - public function getListeners(){ |
|
129 | + public function getListeners() { |
|
130 | 130 | return $this->listeners->getArrayCopy(); |
131 | 131 | } |
132 | 132 |
@@ -20,4 +20,4 @@ |
||
20 | 20 | |
21 | 21 | |
22 | 22 | class ObjectStorage |
23 | - extends \SplObjectStorage{} |
|
23 | + extends \SplObjectStorage {} |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param $subject |
37 | 37 | * @return |
38 | 38 | */ |
39 | - public function __construct(\ArrayAccess $methodMap, $subject){ |
|
39 | + public function __construct(\ArrayAccess $methodMap, $subject) { |
|
40 | 40 | $this->methodMap = $methodMap; |
41 | 41 | $this->subject = $subject; |
42 | 42 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param $arguments |
49 | 49 | * @return |
50 | 50 | */ |
51 | - public function __call($method, array $arguments){ |
|
52 | - if(array_key_exists($method, $this->methodMap)){ |
|
51 | + public function __call($method, array $arguments) { |
|
52 | + if (array_key_exists($method, $this->methodMap)) { |
|
53 | 53 | return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments); |
54 | 54 | } |
55 | 55 | } |