@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * Class Json |
| 53 | 53 | * @package Platine\Stdlib\Helper |
| 54 | 54 | */ |
| 55 | -class Json |
|
| 56 | -{ |
|
| 55 | +class Json { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * Decode JSON string |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $result = $object->toArray(); |
| 108 | 108 | } else { |
| 109 | 109 | $result = []; |
| 110 | - foreach ((array)$object as $key => $value) { |
|
| 110 | + foreach ((array) $object as $key => $value) { |
|
| 111 | 111 | $result[$key] = $value; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public static function merge(array ...$args): array |
| 129 | 129 | { |
| 130 | - $res = (array)array_shift($args); |
|
| 130 | + $res = (array) array_shift($args); |
|
| 131 | 131 | while (!empty($args)) { |
| 132 | 132 | $next = array_shift($args); |
| 133 | 133 | foreach ($next as $key => $value) { |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | return; |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - $count = count($keys); |
|
| 472 | + $count = count($keys); |
|
| 473 | 473 | if (is_scalar($direction)) { |
| 474 | 474 | $direction = array_fill(0, $count, $direction); |
| 475 | 475 | } elseif (count($direction) !== $count) { |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $max = 0; |
| 937 | 937 | foreach ($array as $key => $value) { |
| 938 | 938 | if (!$expectInt || !is_numeric($key)) { |
| 939 | - $width = mb_strlen((string)$key, 'UTF-8'); |
|
| 939 | + $width = mb_strlen((string) $key, 'UTF-8'); |
|
| 940 | 940 | if ($width > $max) { |
| 941 | 941 | $max = $width; |
| 942 | 942 | } |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | } else { |
| 1058 | 1058 | $itemKey = static::get($item, $key); |
| 1059 | 1059 | if (is_object($itemKey) && method_exists($itemKey, '__toString')) { |
| 1060 | - $itemKey = (string)$itemKey; |
|
| 1060 | + $itemKey = (string) $itemKey; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | $results[$itemKey] = $itemValue; |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | $keys = array_rand($array, $number); |
| 1162 | 1162 | |
| 1163 | 1163 | $results = []; |
| 1164 | - foreach ((array)$keys as $key) { |
|
| 1164 | + foreach ((array) $keys as $key) { |
|
| 1165 | 1165 | $results[] = $array[$key]; |
| 1166 | 1166 | } |
| 1167 | 1167 | |
@@ -1211,18 +1211,18 @@ discard block |
||
| 1211 | 1211 | if (preg_match('/^\-\w=/', $arg)) { |
| 1212 | 1212 | $normalized = array_merge( |
| 1213 | 1213 | $normalized, |
| 1214 | - (array)explode('=', $arg) |
|
| 1214 | + (array) explode('=', $arg) |
|
| 1215 | 1215 | ); |
| 1216 | 1216 | } elseif (preg_match('/^\-\w{2,}/', $arg)) { |
| 1217 | 1217 | $splitArgs = implode(' -', str_split(ltrim($arg, '-'))); |
| 1218 | 1218 | $normalized = array_merge( |
| 1219 | 1219 | $normalized, |
| 1220 | - (array)explode(' ', '-' . $splitArgs) |
|
| 1220 | + (array) explode(' ', '-' . $splitArgs) |
|
| 1221 | 1221 | ); |
| 1222 | 1222 | } elseif (preg_match('/^\-\-([^\s\=]+)\=/', $arg)) { |
| 1223 | 1223 | $normalized = array_merge( |
| 1224 | 1224 | $normalized, |
| 1225 | - (array)explode('=', $arg) |
|
| 1225 | + (array) explode('=', $arg) |
|
| 1226 | 1226 | ); |
| 1227 | 1227 | } else { |
| 1228 | 1228 | $normalized[] = $arg; |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * Class Arr |
| 58 | 58 | * @package Platine\Stdlib\Helper |
| 59 | 59 | */ |
| 60 | -class Arr |
|
| 61 | -{ |
|
| 60 | +class Arr { |
|
| 62 | 61 | |
| 63 | 62 | /** |
| 64 | 63 | * Convert an array, object or string to array |
@@ -159,8 +158,7 @@ discard block |
||
| 159 | 158 | * @return mixed If the key does not exist in the array or object, |
| 160 | 159 | * the default value will be returned instead. |
| 161 | 160 | */ |
| 162 | - public static function getValue($object, $key, $default = null) |
|
| 163 | - { |
|
| 161 | + public static function getValue($object, $key, $default = null) { |
|
| 164 | 162 | if ($key instanceof Closure) { |
| 165 | 163 | return $key($object, $default); |
| 166 | 164 | } |
@@ -220,8 +218,7 @@ discard block |
||
| 220 | 218 | * |
| 221 | 219 | * @return mixed|null |
| 222 | 220 | */ |
| 223 | - public static function remove(array &$array, $key, $default = null) |
|
| 224 | - { |
|
| 221 | + public static function remove(array &$array, $key, $default = null) { |
|
| 225 | 222 | if (isset($array[$key]) || array_key_exists($key, $array)) { |
| 226 | 223 | $value = $array[$key]; |
| 227 | 224 | |
@@ -296,8 +293,7 @@ discard block |
||
| 296 | 293 | * @param mixed $default |
| 297 | 294 | * @return mixed |
| 298 | 295 | */ |
| 299 | - public static function pull(array &$array, $key, $default = null) |
|
| 300 | - { |
|
| 296 | + public static function pull(array &$array, $key, $default = null) { |
|
| 301 | 297 | $value = static::get($array, $key, $default); |
| 302 | 298 | |
| 303 | 299 | static::forget($array, $key); |
@@ -756,8 +752,7 @@ discard block |
||
| 756 | 752 | * @param mixed $default |
| 757 | 753 | * @return mixed |
| 758 | 754 | */ |
| 759 | - public static function get($array, $key = null, $default = null) |
|
| 760 | - { |
|
| 755 | + public static function get($array, $key = null, $default = null) { |
|
| 761 | 756 | if ($key === null) { |
| 762 | 757 | return $array; |
| 763 | 758 | } |
@@ -1137,8 +1132,7 @@ discard block |
||
| 1137 | 1132 | * |
| 1138 | 1133 | * @return mixed |
| 1139 | 1134 | */ |
| 1140 | - public static function random(array $array, ?int $number = null) |
|
| 1141 | - { |
|
| 1135 | + public static function random(array $array, ?int $number = null) { |
|
| 1142 | 1136 | $requested = $number === null ? 1 : $number; |
| 1143 | 1137 | $count = count($array); |
| 1144 | 1138 | |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * Class AbstractConfiguration |
| 57 | 57 | * @package Platine\Stdlib\Config |
| 58 | 58 | */ |
| 59 | -abstract class AbstractConfiguration implements ConfigurationInterface |
|
| 60 | -{ |
|
| 59 | +abstract class AbstractConfiguration implements ConfigurationInterface { |
|
| 61 | 60 | |
| 62 | 61 | /** |
| 63 | 62 | * The raw configuration array |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | /** |
| 69 | 68 | * {@inheritedoc} |
| 70 | 69 | */ |
| 71 | - public function __construct(array $config = []) |
|
| 72 | - { |
|
| 70 | + public function __construct(array $config = []) { |
|
| 73 | 71 | $configuration = array_merge($this->getDefault(), $config); |
| 74 | 72 | $this->load($configuration); |
| 75 | 73 | } |
@@ -77,8 +75,7 @@ discard block |
||
| 77 | 75 | /** |
| 78 | 76 | * {@inheritedoc} |
| 79 | 77 | */ |
| 80 | - public function get(string $name) |
|
| 81 | - { |
|
| 78 | + public function get(string $name) { |
|
| 82 | 79 | if (!$this->has($name)) { |
| 83 | 80 | throw new InvalidArgumentException(sprintf( |
| 84 | 81 | 'Configuration [%s] does not exist', |