@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param string $class_type_interface_or_instance The expected target class/type/interface/instance |
| 36 | 36 | */ |
| 37 | - public function __construct($class_type_interface_or_instance=null) |
|
| 37 | + public function __construct($class_type_interface_or_instance = null) |
|
| 38 | 38 | { |
| 39 | 39 | if ($class_type_interface_or_instance) { |
| 40 | 40 | $this->expectedTarget = $class_type_interface_or_instance; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return string The PHP code corresponding to this call chain |
| 110 | 110 | */ |
| 111 | - protected function toString(array $options=[]) |
|
| 111 | + protected function toString(array $options = []) |
|
| 112 | 112 | { |
| 113 | 113 | $target = isset($options['target']) ? $options['target'] : $this->expectedTarget; |
| 114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | foreach ($this->stack as $i => $call) { |
| 120 | 120 | if (isset($call['method'])) { |
| 121 | 121 | $string .= '->'; |
| 122 | - $string .= $call['method'].'('; |
|
| 122 | + $string .= $call['method'] . '('; |
|
| 123 | 123 | $string .= implode(', ', array_map(function($argument) { |
| 124 | 124 | return static::varExport($argument, ['short_objects']); |
| 125 | 125 | }, $call['arguments'])); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $string .= '[' . static::varExport($call['entry'], ['short_objects']) . ']'; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if (! empty($options['limit']) && $options['limit'] == $i) { |
|
| 132 | + if (!empty($options['limit']) && $options['limit'] == $i) { |
|
| 133 | 133 | break; |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | * @param array $options max_length | alias_instances |
| 145 | 145 | * @return string The PHP code of the variable |
| 146 | 146 | */ |
| 147 | - protected static function varExport($variable, array $options=[]) |
|
| 147 | + protected static function varExport($variable, array $options = []) |
|
| 148 | 148 | { |
| 149 | 149 | $options['max_length'] = isset($options['max_length']) ? $options['max_length'] : 512; |
| 150 | - $options['short_objects'] = ! empty($options['short_objects']) || in_array('short_objects', $options); |
|
| 150 | + $options['short_objects'] = !empty($options['short_objects']) || in_array('short_objects', $options); |
|
| 151 | 151 | |
| 152 | 152 | $export = var_export($variable, true); |
| 153 | 153 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | elseif (is_string($this->expectedTarget)) { |
| 195 | 195 | if (class_exists($this->expectedTarget)) { |
| 196 | - if (! $target instanceof $this->expectedTarget) { |
|
| 196 | + if (!$target instanceof $this->expectedTarget) { |
|
| 197 | 197 | throw new BadTargetClassException($this, $this->expectedTarget, $target); |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | elseif (interface_exists($this->expectedTarget)) { |
| 201 | - if (! $target instanceof $this->expectedTarget) { |
|
| 201 | + if (!$target instanceof $this->expectedTarget) { |
|
| 202 | 202 | throw new BadTargetInterfaceException($this, $this->expectedTarget, $target); |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | return |
| 281 | 281 | $trace[0]['function'] == '__call' |
| 282 | - && $trace[0]['class'] == get_class($current_chained_subject) |
|
| 283 | - && $trace[0]['args'][0] == $method_name |
|
| 282 | + && $trace[0]['class'] == get_class($current_chained_subject) |
|
| 283 | + && $trace[0]['args'][0] == $method_name |
|
| 284 | 284 | && ( |
| 285 | 285 | $trace[$call_user_func_array_position]['file'] == __FILE__ |
| 286 | 286 | && $trace[$call_user_func_array_position]['function'] == 'call_user_func_array' |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * @param mixed $target The target to apply the callchain on |
| 295 | 295 | * @return mixed The value returned once the call chain is called uppon $target |
| 296 | 296 | */ |
| 297 | - public function __invoke($target=null) |
|
| 297 | + public function __invoke($target = null) |
|
| 298 | 298 | { |
| 299 | 299 | $out = $this->checkTarget($target); |
| 300 | 300 | |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | ); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - if (! $is_called && is_callable($call['method'])) { |
|
| 313 | + if (!$is_called && is_callable($call['method'])) { |
|
| 314 | 314 | $arguments = $this->prepareArgs($call['arguments'], $out); |
| 315 | 315 | $out = call_user_func_array($call['method'], $arguments); |
| 316 | 316 | $is_called = true; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if (! $is_called) { |
|
| 319 | + if (!$is_called) { |
|
| 320 | 320 | throw new \BadMethodCallException( |
| 321 | 321 | $call['method'] . "() is neither a method of " . get_class($out) |
| 322 | 322 | . " nor a function" |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | else { |
| 327 | - $out = $out[ $call['entry'] ]; |
|
| 327 | + $out = $out[$call['entry']]; |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | catch (\Exception $e) { |