@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $results = []; |
| 50 | 50 | foreach ($array as $values) { |
| 51 | - if (! is_array($values)) { |
|
| 51 | + if ( ! is_array($values)) { |
|
| 52 | 52 | continue; |
| 53 | 53 | } |
| 54 | 54 | $results = array_merge($results, $values); |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | foreach ($array as $key => $value) { |
| 82 | 82 | if (is_array($value) && ! empty($value)) { |
| 83 | - $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
|
| 83 | + $results = array_merge($results, static::dot($value, $prepend . $key . '.')); |
|
| 84 | 84 | } else { |
| 85 | - $results[$prepend.$key] = $value; |
|
| 85 | + $results[$prepend . $key] = $value; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public static function get($array, $key, $default = null) |
| 221 | 221 | { |
| 222 | - if (! static::accessible($array)) { |
|
| 222 | + if ( ! static::accessible($array)) { |
|
| 223 | 223 | return $default; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | $keys = (array) $keys; |
| 259 | 259 | |
| 260 | - if (! $array) { |
|
| 260 | + if ( ! $array) { |
|
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | // If the key doesn't exist at this depth, we will just create an empty array |
| 420 | 420 | // to hold the next value, allowing us to create the arrays to hold final |
| 421 | 421 | // values at the correct depth. Then we'll keep digging into the array. |
| 422 | - if (! isset($array[$key]) || ! is_array($array[$key])) { |
|
| 422 | + if ( ! isset($array[$key]) || ! is_array($array[$key])) { |
|
| 423 | 423 | $array[$key] = []; |
| 424 | 424 | } |
| 425 | 425 | |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | return $target; |
| 482 | 482 | } |
| 483 | 483 | $key = is_array($key) ? $key : explode('.', $key); |
| 484 | - while (! is_null($segment = array_shift($key))) { |
|
| 484 | + while ( ! is_null($segment = array_shift($key))) { |
|
| 485 | 485 | if ($segment === '*') { |
| 486 | - if (! is_array($target)) { |
|
| 486 | + if ( ! is_array($target)) { |
|
| 487 | 487 | return $default; |
| 488 | 488 | } |
| 489 | 489 | $result = static::pluck($target, $key); |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @param string|Closure $handler |
| 24 | 24 | */ |
| 25 | - public function __construct( $handler ) { |
|
| 26 | - $this->set( $handler ); |
|
| 25 | + public function __construct($handler) { |
|
| 26 | + $this->set($handler); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | * @param string|Closure $handler |
| 33 | 33 | * @return callable|array|null |
| 34 | 34 | */ |
| 35 | - protected function parse( $handler ) { |
|
| 36 | - if ( $handler instanceof Closure ) { |
|
| 35 | + protected function parse($handler) { |
|
| 36 | + if ($handler instanceof Closure) { |
|
| 37 | 37 | return $handler; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if ( is_string( $handler ) ) { |
|
| 41 | - $handlerPieces = preg_split( '/@|::/', $handler, 2 ); |
|
| 42 | - if ( count( $handlerPieces ) === 1 ) { |
|
| 43 | - if ( is_callable( $handlerPieces[0] ) ) { |
|
| 40 | + if (is_string($handler)) { |
|
| 41 | + $handlerPieces = preg_split('/@|::/', $handler, 2); |
|
| 42 | + if (count($handlerPieces) === 1) { |
|
| 43 | + if (is_callable($handlerPieces[0])) { |
|
| 44 | 44 | return $handlerPieces[0]; |
| 45 | 45 | } else { |
| 46 | 46 | return null; |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | * @param string|Closure $new_handler |
| 63 | 63 | * @return null |
| 64 | 64 | */ |
| 65 | - public function set( $new_handler ) { |
|
| 66 | - $handler = $this->parse( $new_handler ); |
|
| 65 | + public function set($new_handler) { |
|
| 66 | + $handler = $this->parse($new_handler); |
|
| 67 | 67 | |
| 68 | - if ( $handler === null ) { |
|
| 69 | - throw new Exception( 'No or invalid handler provided.' ); |
|
| 68 | + if ($handler === null) { |
|
| 69 | + throw new Exception('No or invalid handler provided.'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $this->handler = $handler; |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function execute() { |
| 81 | 81 | $arguments = func_get_args(); |
| 82 | - if ( is_callable( $this->handler ) ) { |
|
| 83 | - return call_user_func_array( $this->handler, $arguments ); |
|
| 82 | + if (is_callable($this->handler)) { |
|
| 83 | + return call_user_func_array($this->handler, $arguments); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $class = $this->handler['class']; |
| 87 | 87 | $method = $this->handler['method']; |
| 88 | 88 | |
| 89 | - $controller = Framework::instantiate( $class ); |
|
| 90 | - return call_user_func_array( [$controller, $method], $arguments ); |
|
| 89 | + $controller = Framework::instantiate($class); |
|
| 90 | + return call_user_func_array([$controller, $method], $arguments); |
|
| 91 | 91 | } |
| 92 | 92 | } |