Passed
Push — master ( 85a956...018647 )
by Jean
02:31
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
             }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      * @param  $target The target to apply the callchain on
168 168
      * @return The value returned once the call chain is called uppon $target
169 169
      */
170
-    public function __invoke($target=null)
170
+    public function __invoke($target = null)
171 171
     {
172 172
         $out = $this->checkTarget($target);
173 173
         
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
                             // not be a callable
187 187
                             if (
188 188
                                 (
189
-                                    (  PHP_VERSION_ID < 70000
189
+                                    (PHP_VERSION_ID < 70000
190 190
                                         && $e->getTrace()[2]['file'] == __FILE__
191 191
                                         && $e->getTrace()[2]['function'] == 'call_user_func_array'
192 192
                                         && $e->getTrace()[1]['function'] == $call['method']
193 193
                                         && $e->getTrace()[1]['class'] == get_class($out)
194 194
                                     )
195 195
                                     ||
196
-                                    (   PHP_VERSION_ID >= 70000
196
+                                    (PHP_VERSION_ID >= 70000
197 197
                                         && $e->getTrace()[1]['file'] == __FILE__
198 198
                                         && $e->getTrace()[1]['function'] == 'call_user_func_array'
199 199
                                         // The magic method call doesn't exist in the stack with PHP 7
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
                         }
211 211
                     }
212 212
                     
213
-                    if (! $is_called && is_callable($call['method'])) {
213
+                    if (!$is_called && is_callable($call['method'])) {
214 214
                         $arguments = $this->prepareArgs($call['arguments'], $out);
215 215
                         
216 216
                         $out = call_user_func_array($call['method'], $arguments);
217 217
                         $is_called = true;
218 218
                     }
219 219
                     
220
-                    if (! $is_called) {
220
+                    if (!$is_called) {
221 221
                         throw new \BadMethodCallException(
222 222
                             $call['method'] . "() is neither a method of " . get_class($out)
223 223
                             . " nor a function"
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                     }
226 226
                 }
227 227
                 else {
228
-                    $out = $out[ $call['entry'] ];
228
+                    $out = $out[$call['entry']];
229 229
                 }
230 230
             }
231 231
             catch (\Exception $e) {
Please login to merge, or discard this patch.