Completed
Push — master ( 92f6d1...2f9def )
by Jean
14:22
created
src/DeferredCallChain.php 1 patch
Spacing   +15 added lines, -15 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
             }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                     $class = $current_chained_subject;
159 159
                 }
160 160
                 
161
-                $callable = $class .'::'. $method_name;
161
+                $callable = $class.'::'.$method_name;
162 162
             }
163 163
             
164 164
             $current_chained_subject = call_user_func_array(
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
         
204 204
         return  
205 205
                 ($trace[0]['function'] == '__call' || $trace[0]['function'] == '__callStatic')
206
-            &&  $trace[0]['class']    == (is_string($current_chained_subject) 
206
+            &&  $trace[0]['class'] == (is_string($current_chained_subject) 
207 207
                                        ? $current_chained_subject 
208 208
                                        : get_class($current_chained_subject))
209
-            &&  $trace[0]['args'][0]  == $method_name
209
+            &&  $trace[0]['args'][0] == $method_name
210 210
             && (
211 211
                     $trace[$call_user_func_array_position]['file'] == __FILE__
212 212
                 &&  $trace[$call_user_func_array_position]['function'] == 'call_user_func_array'
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      * @param  mixed $target The target to apply the callchain on
221 221
      * @return mixed The value returned once the call chain is called uppon $target
222 222
      */
223
-    public function __invoke($target=null)
223
+    public function __invoke($target = null)
224 224
     {
225 225
         $out = $this->checkTarget($target);
226 226
         
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
                         );
238 238
                     }
239 239
                     
240
-                    if (! $is_called && (
241
-                                (is_string($out) && is_callable($out .'::'.$call['method']))
242
-                            ||  (is_object($out) && is_callable(get_class($out) .'::'.$call['method']))
240
+                    if ( ! $is_called && (
241
+                                (is_string($out) && is_callable($out.'::'.$call['method']))
242
+                            ||  (is_object($out) && is_callable(get_class($out).'::'.$call['method']))
243 243
                         )
244 244
                     ) {
245 245
                         $is_called = $this->checkMethodIsReallyCallable(
@@ -250,22 +250,22 @@  discard block
 block discarded – undo
250 250
                         );
251 251
                     }
252 252
                     
253
-                    if (! $is_called && is_callable($call['method'])) {
253
+                    if ( ! $is_called && is_callable($call['method'])) {
254 254
                         $arguments = $this->prepareArgs($call['arguments'], $out);
255 255
                         $out = call_user_func_array($call['method'], $arguments);
256 256
                         $is_called = true;
257 257
                     }
258 258
                     
259
-                    if (! $is_called) {
259
+                    if ( ! $is_called) {
260 260
                         throw new \BadMethodCallException(
261
-                            $call['method'] . "() is neither a method of "
261
+                            $call['method']."() is neither a method of "
262 262
                             . (is_string($out) ? $out : get_class($out))
263 263
                             . " nor a function"
264 264
                         );
265 265
                     }
266 266
                 }
267 267
                 else {
268
-                    $out = $out[ $call['entry'] ];
268
+                    $out = $out[$call['entry']];
269 269
                 }
270 270
             }
271 271
             catch (\Exception $e) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                     'message',
281 281
                     $e->getMessage()
282 282
                     . "\nWhen applying $callchain_description defined at "
283
-                    . $call['file'] . ':' . $call['line']
283
+                    . $call['file'].':'.$call['line']
284 284
                 );
285 285
                 
286 286
                 // Throw $e with the good stack (usage exception)
Please login to merge, or discard this patch.
src_5.6/DeferredCallChain.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
             $out = $this->expectedTarget;
82 82
         } elseif (is_string($this->expectedTarget)) {
83 83
             if (class_exists($this->expectedTarget)) {
84
-                if (!$target instanceof $this->expectedTarget) {
84
+                if ( ! $target instanceof $this->expectedTarget) {
85 85
                     throw new BadTargetClassException($this, $this->expectedTarget, $target);
86 86
                 }
87 87
             } elseif (interface_exists($this->expectedTarget)) {
88
-                if (!$target instanceof $this->expectedTarget) {
88
+                if ( ! $target instanceof $this->expectedTarget) {
89 89
                     throw new BadTargetInterfaceException($this, $this->expectedTarget, $target);
90 90
                 }
91 91
             } elseif (type_exists($this->expectedTarget)) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                 } elseif (is_string($current_chained_subject)) {
125 125
                     $class = $current_chained_subject;
126 126
                 }
127
-                $callable = $class . '::' . $method_name;
127
+                $callable = $class.'::'.$method_name;
128 128
             }
129 129
             $current_chained_subject = call_user_func_array($callable, $arguments);
130 130
         } catch (\BadMethodCallException $e) {
@@ -169,23 +169,23 @@  discard block
 block discarded – undo
169 169
                     if (is_callable([$out, $call['method']])) {
170 170
                         $is_called = $this->checkMethodIsReallyCallable('->', $out, $call['method'], $call['arguments']);
171 171
                     }
172
-                    if (!$is_called && (is_string($out) && is_callable($out . '::' . $call['method']) || is_object($out) && is_callable(get_class($out) . '::' . $call['method']))) {
172
+                    if ( ! $is_called && (is_string($out) && is_callable($out.'::'.$call['method']) || is_object($out) && is_callable(get_class($out).'::'.$call['method']))) {
173 173
                         $is_called = $this->checkMethodIsReallyCallable('::', $out, $call['method'], $call['arguments']);
174 174
                     }
175
-                    if (!$is_called && is_callable($call['method'])) {
175
+                    if ( ! $is_called && is_callable($call['method'])) {
176 176
                         $arguments = $this->prepareArgs($call['arguments'], $out);
177 177
                         $out = call_user_func_array($call['method'], $arguments);
178 178
                         $is_called = true;
179 179
                     }
180
-                    if (!$is_called) {
181
-                        throw new \BadMethodCallException($call['method'] . "() is neither a method of " . (is_string($out) ? $out : get_class($out)) . " nor a function");
180
+                    if ( ! $is_called) {
181
+                        throw new \BadMethodCallException($call['method']."() is neither a method of ".(is_string($out) ? $out : get_class($out))." nor a function");
182 182
                     }
183 183
                 } else {
184 184
                     $out = $out[$call['entry']];
185 185
                 }
186 186
             } catch (\Exception $e) {
187 187
                 $callchain_description = $this->toString(['target' => $target, 'limit' => $i]);
188
-                VisibilityViolator::setHiddenProperty($e, 'message', $e->getMessage() . "\nWhen applying {$callchain_description} defined at " . $call['file'] . ':' . $call['line']);
188
+                VisibilityViolator::setHiddenProperty($e, 'message', $e->getMessage()."\nWhen applying {$callchain_description} defined at ".$call['file'].':'.$call['line']);
189 189
                 // Throw $e with the good stack (usage exception)
190 190
                 throw $e;
191 191
             }
Please login to merge, or discard this patch.