Completed
Push — v1.ns ( 6f2676...0f96a8 )
by Timo
03:42
created
src/Event/Event.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param string $name the name of the event
52 52
      * @param array|ArrayAccess $headers the headers for the event 
53 53
      */
54
-    public function __construct($subject, $name, $parameters = array(), $type = false){
54
+    public function __construct($subject, $name, $parameters = array(), $type = false) {
55 55
         parent::__construct($subject, Test::ensureArrayAccess($parameters));
56 56
         $this->name = $name;
57 57
         $this->type = $type ? $type : get_class($this);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @access public
64 64
      * @return string the name of the event
65 65
      */
66
-    public function getName(){
66
+    public function getName() {
67 67
         return $this->name;
68 68
     }
69 69
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @access public
75 75
      * @return string the type of the event
76 76
      */
77
-    public function getType(){
77
+    public function getType() {
78 78
         return $this->name;
79 79
     }
80 80
   
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @access public
85 85
      * @param mixed $value the return-value to set 
86 86
      */
87
-    public function setReturnValue($value){
87
+    public function setReturnValue($value) {
88 88
         $this->value = $value;
89 89
     }
90 90
   
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @access public
95 95
      * @return mixed the return-value to set
96 96
      */
97
-    public function getReturnValue(){
97
+    public function getReturnValue() {
98 98
         return $this->value;
99 99
     }
100 100
   
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
      * @access public
105 105
      * @param boolean $processed 
106 106
      */
107
-    public function setProcessed($processed){
108
-        $this->processed = (boolean) $processed;
107
+    public function setProcessed($processed) {
108
+        $this->processed = (boolean)$processed;
109 109
     }
110 110
 
111 111
     /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @access public
115 115
      * @return boolean wether the event is processed 
116 116
      */
117
-    public function isProcessed(){
117
+    public function isProcessed() {
118 118
         return $this->processed;
119 119
     }
120 120
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @access public
125 125
      * @return mixed the subject/content
126 126
      */
127
-    public function getSubject(){
127
+    public function getSubject() {
128 128
         return $this->getContent();
129 129
     }
130 130
 }
Please login to merge, or discard this patch.
src/Dispatcher/EventClassDispatcher.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Dispatcher/ObjectMapDispatcher.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Dispatcher/ObjectEventDispatcher.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Dispatcher/Dispatcher.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Dispatcher/IteratingDispatcher.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     
Please login to merge, or discard this patch.
src/Dispatcher/ClassDispatcher.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Util/Test.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 class Test {
16 16
 
17 17
 
18
-    public static function assertClassHasConstructor($className){
19
-        return (boolean) ReflectionPool::getInstance($className)->getConstructor();
18
+    public static function assertClassHasConstructor($className) {
19
+        return (boolean)ReflectionPool::getInstance($className)->getConstructor();
20 20
     }
21 21
 
22
-    public static function assertRequiredConstructorParameters($className, $parameters){
22
+    public static function assertRequiredConstructorParameters($className, $parameters) {
23 23
             return (boolean)
24 24
                 !self::assertClassHasConstructor($className) ||
25 25
                 count($parameters) >= ReflectionPool::getInstance($className)
@@ -27,55 +27,55 @@  discard block
 block discarded – undo
27 27
                     ->getNumberOfRequiredParameters();
28 28
     }
29 29
 
30
-    public static function assertInstanceOf($className, $object){
31
-        return (boolean) ReflectionPool::getInstance($className)
30
+    public static function assertInstanceOf($className, $object) {
31
+        return (boolean)ReflectionPool::getInstance($className)
32 32
             ->isInstance($object);
33 33
     }
34 34
 
35
-    public static function assertClassOrInterfaceExists($className){
36
-        return (boolean) class_exists($className) || interface_exists($className);
35
+    public static function assertClassOrInterfaceExists($className) {
36
+        return (boolean)class_exists($className) || interface_exists($className);
37 37
     }
38 38
 
39
-    public static function assertImplements($className, $interfaceName){
39
+    public static function assertImplements($className, $interfaceName) {
40 40
         $className = is_object($className) ? get_class($className) : $className;
41
-        $res = false;//throw new \Exception();
41
+        $res = false; //throw new \Exception();
42 42
         try {  
43 43
             class_exists($className); 
44
-            $res =  ReflectionPool::getInstance($className)
44
+            $res = ReflectionPool::getInstance($className)
45 45
                 ->implementsInterface($interfaceName);             
46
-        }  catch (\Exception $e){
46
+        } catch (\Exception $e) {
47 47
             $res = false; 
48 48
         } 
49
-        return $res;;
49
+        return $res; ;
50 50
     }
51 51
 
52
-    public static function assertMessage($message){
52
+    public static function assertMessage($message) {
53 53
         return self::assertImplements($message, '\PEIP\INF\Message\Message');
54 54
     }
55 55
 
56
-    public static function assertEvent($event){
56
+    public static function assertEvent($event) {
57 57
         return self::assertImplements($event, '\PEIP\INF\Event\Event');
58 58
     }
59 59
 
60
-    public static function assertEventSubject($event){
60
+    public static function assertEventSubject($event) {
61 61
         return self::assertImplements($event, '\PEIP\INF\Event\Event')
62 62
             && $event->getSubject();
63 63
     }
64 64
 
65
-    public static function assertEventObjectSubject($event){
65
+    public static function assertEventObjectSubject($event) {
66 66
         return self::assertEventSubject($event)
67 67
             && is_object($event->getSubject());
68 68
     }
69
-    public static function assertArrayAccess($var){
70
-        return (boolean) is_array($var) || $var instanceof \ArrayAccess;
69
+    public static function assertArrayAccess($var) {
70
+        return (boolean)is_array($var) || $var instanceof \ArrayAccess;
71 71
     }
72 72
 
73
-    public static function assertHandler($var){
74
-        return (boolean) is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler;
73
+    public static function assertHandler($var) {
74
+        return (boolean)is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler;
75 75
     }
76 76
 
77
-    public static function castType($var, $type){
78
-        switch($type){
77
+    public static function castType($var, $type) {
78
+        switch ($type) {
79 79
             case 'string':
80 80
                 $var = (string)$var;
81 81
                 break;
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
         return $var;
100 100
     }
101 101
 
102
-    public static function ensureArrayAccess($var){
103
-        if(!Test::assertArrayAccess($var)){
102
+    public static function ensureArrayAccess($var) {
103
+        if (!Test::assertArrayAccess($var)) {
104 104
             throw new \InvalidArgumentException(
105 105
                 'Value is not an array nor an instance of ArrayAccess'
106 106
             );
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
 
112
-    public static function ensureHandler($var){
113
-        if(!Test::assertHandler($var)){
112
+    public static function ensureHandler($var) {
113
+        if (!Test::assertHandler($var)) {
114 114
             throw new \InvalidArgumentException(
115 115
                 'Value is not an callable nor an instance of \PEIP\INF\Handler\Handler'
116 116
             );
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
         return $var;
119 119
     }
120 120
 
121
-    public static function ensureImplements($className, $interfaceName){
122
-        if(!Test::assertImplements($className, $interfaceName)){
121
+    public static function ensureImplements($className, $interfaceName) {
122
+        if (!Test::assertImplements($className, $interfaceName)) {
123 123
             throw new \InvalidArgumentException(
124 124
                 'Class "'.$className.'" is not an instanceof "'.$interfaceName.'"'
125 125
             );
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         return $className;
128 128
     }
129 129
 
130
-    public static function assertMethod($className, $methodname){
130
+    public static function assertMethod($className, $methodname) {
131 131
         return ReflectionPool::getInstance($className)->hasMethod($methodname);
132 132
     }
133 133
 
Please login to merge, or discard this patch.
src/Util/ReflectionPool.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@
 block discarded – undo
22 22
      * @param $argument
23 23
      * @return ReflectionClass
24 24
      */
25
-    public  static function getInstance($argument){
25
+    public  static function getInstance($argument) {
26 26
 
27 27
         $className = is_object($argument)
28 28
             ? get_class($argument)
29
-            : (string) $argument;
29
+            : (string)$argument;
30 30
         return isset(self::$instances[$className])
31 31
             ? self::$instances[$className]
32 32
             : self::$instances[$className] = new \ReflectionClass($className);
Please login to merge, or discard this patch.