@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class Php |
53 | 53 | * @package Platine\Stdlib\Helper |
54 | 54 | */ |
55 | -class Php |
|
56 | -{ |
|
55 | +class Php { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * Call by callback |
@@ -62,13 +61,13 @@ discard block |
||
62 | 61 | * |
63 | 62 | * @return mixed |
64 | 63 | */ |
65 | - public static function call($callback, ...$args) |
|
66 | - { |
|
64 | + public static function call($callback, ...$args) { |
|
67 | 65 | if (is_string($callback)) { |
68 | 66 | // className::method |
69 | 67 | if (strpos($callback, '::') > 0) { |
70 | 68 | $callback = explode('::', $callback, 2); |
71 | - } elseif (function_exists($callback)) { //function |
|
69 | + } elseif (function_exists($callback)) { |
|
70 | +//function |
|
72 | 71 | return $callback(...$args); |
73 | 72 | } |
74 | 73 | } elseif (is_object($callback) && method_exists($callback, '__invoke')) { |
@@ -93,8 +92,7 @@ discard block |
||
93 | 92 | * |
94 | 93 | * @return mixed |
95 | 94 | */ |
96 | - public static function callArray($callback, array $args) |
|
97 | - { |
|
95 | + public static function callArray($callback, array $args) { |
|
98 | 96 | return self::call($callback, ...$args); |
99 | 97 | } |
100 | 98 |
@@ -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 |
@@ -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 |