Passed
Push — master ( c6a215...6472b7 )
by Jean
01:59
created
src/DeferredCallChain.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * 
37 37
      * @param string $class_type_interface_or_instance The expected target class/type/interface/instance
38 38
      */
39
-    public function __construct($class_type_interface_or_instance=null)
39
+    public function __construct($class_type_interface_or_instance = null)
40 40
     {
41 41
         if ($class_type_interface_or_instance) {
42 42
             $this->expectedTarget = $class_type_interface_or_instance;
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
         }
102 102
         elseif (is_string($this->expectedTarget)) {
103 103
             if (class_exists($this->expectedTarget)) {
104
-                if (! $target instanceof $this->expectedTarget) {
104
+                if (!$target instanceof $this->expectedTarget) {
105 105
                     throw new BadTargetClassException($this, $this->expectedTarget, $target);
106 106
                 }
107 107
             }
108 108
             elseif (interface_exists($this->expectedTarget)) {
109
-                if (! $target instanceof $this->expectedTarget) {
109
+                if (!$target instanceof $this->expectedTarget) {
110 110
                     throw new BadTargetInterfaceException($this, $this->expectedTarget, $target);
111 111
                 }
112 112
             }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                     $class = $current_chained_subject;
158 158
                 }
159 159
                 
160
-                $callable = $class .'::'. $method_name;
160
+                $callable = $class . '::' . $method_name;
161 161
             }
162 162
             
163 163
             $current_chained_subject = call_user_func_array(
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
         
203 203
         return  
204 204
                 ($trace[0]['function'] == '__call' || $trace[0]['function'] == '__callStatic')
205
-            &&  $trace[0]['class']    == get_class($current_chained_subject)
206
-            &&  $trace[0]['args'][0]  == $method_name
205
+            &&  $trace[0]['class'] == get_class($current_chained_subject)
206
+            &&  $trace[0]['args'][0] == $method_name
207 207
             && (
208 208
                     $trace[$call_user_func_array_position]['file'] == __FILE__
209 209
                 &&  $trace[$call_user_func_array_position]['function'] == 'call_user_func_array'
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * @param  mixed $target The target to apply the callchain on
218 218
      * @return mixed The value returned once the call chain is called uppon $target
219 219
      */
220
-    public function __invoke($target=null)
220
+    public function __invoke($target = null)
221 221
     {
222 222
         $out = $this->checkTarget($target);
223 223
         
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
                         );
235 235
                     }
236 236
                     
237
-                    if (! $is_called && (
238
-                                (is_string($out) && is_callable($out .'::'.$call['method']))
239
-                            ||  (is_object($out) && is_callable(get_class($out) .'::'.$call['method']))
237
+                    if (!$is_called && (
238
+                                (is_string($out) && is_callable($out . '::' . $call['method']))
239
+                            ||  (is_object($out) && is_callable(get_class($out) . '::' . $call['method']))
240 240
                         )
241 241
                     ) {
242 242
                         $is_called = $this->checkMethodIsReallyCallable(
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
                         );
248 248
                     }
249 249
                     
250
-                    if (! $is_called && is_callable($call['method'])) {
250
+                    if (!$is_called && is_callable($call['method'])) {
251 251
                         $arguments = $this->prepareArgs($call['arguments'], $out);
252 252
                         $out = call_user_func_array($call['method'], $arguments);
253 253
                         $is_called = true;
254 254
                     }
255 255
                     
256
-                    if (! $is_called) {
256
+                    if (!$is_called) {
257 257
                         throw new \BadMethodCallException(
258 258
                             $call['method'] . "() is neither a method of " . get_class($out)
259 259
                             . " nor a function"
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                     }
262 262
                 }
263 263
                 else {
264
-                    $out = $out[ $call['entry'] ];
264
+                    $out = $out[$call['entry']];
265 265
                 }
266 266
             }
267 267
             catch (\Exception $e) {
Please login to merge, or discard this patch.