Completed
Push — master ( f9347c...d6492d )
by Jean
02:18
created
src/DeferredCallChain.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * 
34 34
      * @param string $key The entry to acces
35 35
      */
36
-    public function __construct($class_type_or_instance=null)
36
+    public function __construct($class_type_or_instance = null)
37 37
     {
38 38
         if ($class_type_or_instance) {
39 39
             $this->expectedTarget = $class_type_or_instance;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         foreach ($this->stack as $i => $call) {
103 103
             if (isset($call['method'])) {
104 104
                 $string .= '->';
105
-                $string .= $call['method'].'(';
105
+                $string .= $call['method'] . '(';
106 106
                 $string .= implode(', ', array_map(function($argument) {
107 107
                     return var_export($argument, true);
108 108
                 }, $call['arguments']));
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
         }
135 135
         elseif (is_string($this->expectedTarget)) {
136 136
             if (class_exists($this->expectedTarget)) {
137
-                if (! $target instanceof $this->expectedTarget) {
137
+                if (!$target instanceof $this->expectedTarget) {
138 138
                     throw new BadTargetClassException($this, $this->expectedTarget, $target);
139 139
                 }
140 140
             }
141 141
             elseif (interface_exists($this->expectedTarget)) {
142
-                if (! $target instanceof $this->expectedTarget) {
142
+                if (!$target instanceof $this->expectedTarget) {
143 143
                     throw new BadTargetInterfaceException($this, $this->expectedTarget, $target);
144 144
                 }
145 145
             }
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
         
215 215
         return  
216 216
                 $trace[0]['function'] == '__call'
217
-            &&  $trace[0]['class']    == get_class($current_chained_subject)
218
-            &&  $trace[0]['args'][0]  == $method_name
217
+            &&  $trace[0]['class'] == get_class($current_chained_subject)
218
+            &&  $trace[0]['args'][0] == $method_name
219 219
             && (
220 220
                     $trace[$call_user_func_array_position]['file'] == __FILE__
221 221
                 &&  $trace[$call_user_func_array_position]['function'] == 'call_user_func_array'
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      * @param  mixed $target The target to apply the callchain on
230 230
      * @return mixde The value returned once the call chain is called uppon $target
231 231
      */
232
-    public function __invoke($target=null)
232
+    public function __invoke($target = null)
233 233
     {
234 234
         $out = $this->checkTarget($target);
235 235
         
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
                         );
246 246
                     }
247 247
                     
248
-                    if (! $is_called && is_callable($call['method'])) {
248
+                    if (!$is_called && is_callable($call['method'])) {
249 249
                         $arguments = $this->prepareArgs($call['arguments'], $out);
250 250
                         $out = call_user_func_array($call['method'], $arguments);
251 251
                         $is_called = true;
252 252
                     }
253 253
                     
254
-                    if (! $is_called) {
254
+                    if (!$is_called) {
255 255
                         throw new \BadMethodCallException(
256 256
                             $call['method'] . "() is neither a method of " . get_class($out)
257 257
                             . " nor a function"
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                     }
260 260
                 }
261 261
                 else {
262
-                    $out = $out[ $call['entry'] ];
262
+                    $out = $out[$call['entry']];
263 263
                 }
264 264
             }
265 265
             catch (\Exception $e) {
Please login to merge, or discard this patch.