@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!function_exists('with')) { |
|
| 3 | +if ( ! function_exists('with')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * Return the given object. Useful for chaining. |
| 6 | 6 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if (!function_exists('array_set')) { |
|
| 17 | +if ( ! function_exists('array_set')) { |
|
| 18 | 18 | /** |
| 19 | 19 | * Set an array item to a given value using dot notation. |
| 20 | 20 | * |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | while (count($keys) > 1) { |
| 36 | 36 | $key = array_shift($keys); |
| 37 | 37 | |
| 38 | - if (!isset($array[$key]) || !is_array($array[$key])) { |
|
| 38 | + if ( ! isset($array[$key]) || ! is_array($array[$key])) { |
|
| 39 | 39 | $array[$key] = []; |
| 40 | 40 | } |
| 41 | 41 | $array = &$array[$key]; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -if (!function_exists('array_get')) { |
|
| 49 | +if ( ! function_exists('array_get')) { |
|
| 50 | 50 | /** |
| 51 | 51 | * Get an item from an array using dot notation. |
| 52 | 52 | * |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | foreach (explode('.', $key) as $segment) { |
| 70 | - if (!is_array($array) || !array_key_exists($segment, $array)) { |
|
| 70 | + if ( ! is_array($array) || ! array_key_exists($segment, $array)) { |
|
| 71 | 71 | return $default; |
| 72 | 72 | } |
| 73 | 73 | $array = $array[$segment]; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | -if (!function_exists('array_has')) { |
|
| 80 | +if ( ! function_exists('array_has')) { |
|
| 81 | 81 | /** |
| 82 | 82 | * Check if an item exists in an array using "dot" notation. |
| 83 | 83 | * |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | foreach (explode('.', $key) as $segment) { |
| 100 | - if (!is_array($array) || !array_key_exists($segment, $array)) { |
|
| 100 | + if ( ! is_array($array) || ! array_key_exists($segment, $array)) { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | $array = $array[$segment]; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -if (!function_exists('array_first')) { |
|
| 110 | +if ( ! function_exists('array_first')) { |
|
| 111 | 111 | /** |
| 112 | 112 | * Return the first element in an array passing a given truth test. |
| 113 | 113 | * |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | -if (!function_exists('array_last')) { |
|
| 132 | +if ( ! function_exists('array_last')) { |
|
| 133 | 133 | /** |
| 134 | 134 | * Return the last element in an array passing a given truth test. |
| 135 | 135 | * |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -if (!function_exists('array_flatten')) { |
|
| 148 | +if ( ! function_exists('array_flatten')) { |
|
| 149 | 149 | /** |
| 150 | 150 | * Flatten a multi-dimensional array into a single level. |
| 151 | 151 | * |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | $return = []; |
| 159 | 159 | |
| 160 | - array_walk_recursive($array, function ($x) use (&$return) { |
|
| 160 | + array_walk_recursive($array, function($x) use (&$return) { |
|
| 161 | 161 | $return[] = $x; |
| 162 | 162 | }); |
| 163 | 163 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | -if (!function_exists('array_pluck')) { |
|
| 168 | +if ( ! function_exists('array_pluck')) { |
|
| 169 | 169 | /** |
| 170 | 170 | * Pluck an array of values from an array. |
| 171 | 171 | * |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | -if (!function_exists('data_get')) { |
|
| 198 | +if ( ! function_exists('data_get')) { |
|
| 199 | 199 | /** |
| 200 | 200 | * Get an item from an array or object using "dot" notation. |
| 201 | 201 | * |
@@ -213,17 +213,17 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | foreach (explode('.', $key) as $segment) { |
| 215 | 215 | if (is_array($target)) { |
| 216 | - if (!array_key_exists($segment, $target)) { |
|
| 216 | + if ( ! array_key_exists($segment, $target)) { |
|
| 217 | 217 | return $default; |
| 218 | 218 | } |
| 219 | 219 | $target = $target[$segment]; |
| 220 | 220 | } elseif ($target instanceof ArrayAccess) { |
| 221 | - if (!isset($target[$segment])) { |
|
| 221 | + if ( ! isset($target[$segment])) { |
|
| 222 | 222 | return $default; |
| 223 | 223 | } |
| 224 | 224 | $target = $target[$segment]; |
| 225 | 225 | } elseif (is_object($target)) { |
| 226 | - if (!isset($target->{$segment})) { |
|
| 226 | + if ( ! isset($target->{$segment})) { |
|
| 227 | 227 | return $default; |
| 228 | 228 | } |
| 229 | 229 | $target = $target->{$segment}; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | -if (!function_exists('starts_with')) { |
|
| 239 | +if ( ! function_exists('starts_with')) { |
|
| 240 | 240 | /** |
| 241 | 241 | * Determine if a given string starts with a given substring. |
| 242 | 242 | * |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | -if (!function_exists('snake_case')) { |
|
| 260 | +if ( ! function_exists('snake_case')) { |
|
| 261 | 261 | /** |
| 262 | 262 | * Convert a string to snake case. |
| 263 | 263 | * |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | function snake_case($value, $delimiter = '_') |
| 270 | 270 | { |
| 271 | - if (!ctype_lower($value)) { |
|
| 271 | + if ( ! ctype_lower($value)) { |
|
| 272 | 272 | $value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.$delimiter, $value)); |
| 273 | 273 | } |
| 274 | 274 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | -if (!function_exists('camel_case')) { |
|
| 279 | +if ( ! function_exists('camel_case')) { |
|
| 280 | 280 | /** |
| 281 | 281 | * Convert a value to camel case. |
| 282 | 282 | * |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | -if (!function_exists('class_basename')) { |
|
| 295 | +if ( ! function_exists('class_basename')) { |
|
| 296 | 296 | /** |
| 297 | 297 | * Get the class "basename" of the given object / class. |
| 298 | 298 | * |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | -if (!function_exists('str_random')) { |
|
| 311 | +if ( ! function_exists('str_random')) { |
|
| 312 | 312 | /** |
| 313 | 313 | * Generate a more truly "random" alpha-numeric string. |
| 314 | 314 | * |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | -if (!function_exists('get_random_bytes')) { |
|
| 337 | +if ( ! function_exists('get_random_bytes')) { |
|
| 338 | 338 | /** |
| 339 | 339 | * Generate a more truly "random" bytes. |
| 340 | 340 | * |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | -if (!function_exists('process')) { |
|
| 365 | +if ( ! function_exists('process')) { |
|
| 366 | 366 | /** |
| 367 | 367 | * Process the selected results. |
| 368 | 368 | * |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | function process($results) |
| 374 | 374 | { |
| 375 | - if (!isset($results) || isset($results['Fouttype'])) { |
|
| 375 | + if ( ! isset($results) || isset($results['Fouttype'])) { |
|
| 376 | 376 | return []; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | foreach ($results as $result) { |
| 384 | - if (!is_array($result)) { |
|
| 384 | + if ( ! is_array($result)) { |
|
| 385 | 385 | return [$results]; |
| 386 | 386 | } |
| 387 | 387 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | -if (!function_exists('translate')) { |
|
| 393 | +if ( ! function_exists('translate')) { |
|
| 394 | 394 | /** |
| 395 | 395 | * Return the translation for the foreign. |
| 396 | 396 | * |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | { |
| 403 | 403 | $translator = \App::make('translator'); |
| 404 | 404 | |
| 405 | - if (!$translator->from($model)->hasTranslation($foreign)) { |
|
| 405 | + if ( ! $translator->from($model)->hasTranslation($foreign)) { |
|
| 406 | 406 | return $foreign; |
| 407 | 407 | } |
| 408 | 408 | |