@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function lstrip($chars = " \t\n\r\0\x0B") |
| 17 | 17 | { |
| 18 | - return function ($value) use ($chars) { |
|
| 18 | + return function($value) use ($chars) { |
|
| 19 | 19 | return ltrim($value, $chars); |
| 20 | 20 | }; |
| 21 | 21 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function rstrip($chars = " \t\n\r\0\x0B") |
| 30 | 30 | { |
| 31 | - return function ($value) use ($chars) { |
|
| 31 | + return function($value) use ($chars) { |
|
| 32 | 32 | return rtrim($value, $chars); |
| 33 | 33 | }; |
| 34 | 34 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function strip($chars = " \t\n\r\0\x0B") |
| 43 | 43 | { |
| 44 | - return function ($value) use ($chars) { |
|
| 44 | + return function($value) use ($chars) { |
|
| 45 | 45 | return trim($value, $chars); |
| 46 | 46 | }; |
| 47 | 47 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function length() |
| 55 | 55 | { |
| 56 | - return function ($value) { |
|
| 56 | + return function($value) { |
|
| 57 | 57 | if (is_null($value)) { |
| 58 | 58 | return 0; |
| 59 | 59 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | function key() |
| 75 | 75 | { |
| 76 | - return function ($value, $key) { |
|
| 76 | + return function($value, $key) { |
|
| 77 | 77 | return $key; |
| 78 | 78 | }; |
| 79 | 79 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function lower() |
| 87 | 87 | { |
| 88 | - return function ($value) { |
|
| 88 | + return function($value) { |
|
| 89 | 89 | return strtolower($value); |
| 90 | 90 | }; |
| 91 | 91 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | function upper() |
| 99 | 99 | { |
| 100 | - return function ($value) { |
|
| 100 | + return function($value) { |
|
| 101 | 101 | return strtoupper($value); |
| 102 | 102 | }; |
| 103 | 103 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | function string() |
| 111 | 111 | { |
| 112 | - return function ($value) { |
|
| 112 | + return function($value) { |
|
| 113 | 113 | return (string)$value; |
| 114 | 114 | }; |
| 115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | function json_encode($options = 0, $depth = 512) |
| 125 | 125 | { |
| 126 | - return function ($value) use ($options, $depth) { |
|
| 126 | + return function($value) use ($options, $depth) { |
|
| 127 | 127 | return \json_encode($value, $options, $depth); |
| 128 | 128 | }; |
| 129 | 129 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | function json_decode($assoc = false, $depth = 512, $options = 0) |
| 140 | 140 | { |
| 141 | - return function ($value) use ($assoc, $depth, $options) { |
|
| 141 | + return function($value) use ($assoc, $depth, $options) { |
|
| 142 | 142 | return \json_decode($value, $assoc, $depth, $options); |
| 143 | 143 | }; |
| 144 | 144 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $mappings = array_map('\Zicht\Itertools\conversions\mixed_to_value_getter', (array)$mappings); |
| 180 | 180 | $strategy = conversions\mixed_to_value_getter($strategy); |
| 181 | 181 | |
| 182 | - return function ($value, $key) use ($mappings, $strategy, $discardNull, $discardEmptyContainer, $castToObject) { |
|
| 182 | + return function($value, $key) use ($mappings, $strategy, $discardNull, $discardEmptyContainer, $castToObject) { |
|
| 183 | 183 | $value = $strategy($value); |
| 184 | 184 | $res = []; |
| 185 | 185 | foreach ($mappings as $strategyKey => $strategy) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | if ($discardNull || $discardEmptyContainer) { |
| 189 | 189 | $res = array_filter( |
| 190 | 190 | $res, |
| 191 | - function ($value) use ($discardNull, $discardEmptyContainer) { |
|
| 191 | + function($value) use ($discardNull, $discardEmptyContainer) { |
|
| 192 | 192 | if (null === $value) { |
| 193 | 193 | return !$discardNull; |
| 194 | 194 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $max = getrandmax(); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - return function () use ($min, $max) { |
|
| 221 | + return function() use ($min, $max) { |
|
| 222 | 222 | return rand($min, $max); |
| 223 | 223 | }; |
| 224 | 224 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | function type($strategy = null) |
| 233 | 233 | { |
| 234 | 234 | $strategy = conversions\mixed_to_value_getter($strategy); |
| 235 | - return function ($value) use ($strategy) { |
|
| 235 | + return function($value) use ($strategy) { |
|
| 236 | 236 | $value = $strategy($value); |
| 237 | 237 | return is_object($value) ? get_class($value) : gettype($value); |
| 238 | 238 | }; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $mapping = conversions\mixed_to_value_getter($mapping); |
| 262 | 262 | $strategy = conversions\mixed_to_value_getter($strategy); |
| 263 | 263 | $cache = []; |
| 264 | - return function ($value, $key = null) use ($mapping, $strategy, &$cache) { |
|
| 264 | + return function($value, $key = null) use ($mapping, $strategy, &$cache) { |
|
| 265 | 265 | $cacheKey = \json_encode($strategy($value, $key)); |
| 266 | 266 | if (!array_key_exists($cacheKey, $cache)) { |
| 267 | 267 | $cache[$cacheKey] = $mapping($value, $key); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | function constant($value) |
| 280 | 280 | { |
| 281 | - return function () use ($value) { |
|
| 281 | + return function() use ($value) { |
|
| 282 | 282 | return $value; |
| 283 | 283 | }; |
| 284 | 284 | } |