@@ -46,8 +46,7 @@ |
||
| 46 | 46 | foreach ($array as $key => $value) { |
| 47 | 47 | if (!$this->_skipNulls || ($this->_skipNulls && $value)) { |
| 48 | 48 | $result .= ( |
| 49 | - $function ? $function($key, $value) : |
|
| 50 | - ($valuesFunction ? $valuesFunction($value) : $value) |
|
| 49 | + $function ? $function($key, $value) : ($valuesFunction ? $valuesFunction($value) : $value) |
|
| 51 | 50 | ) . $this->_separator; |
| 52 | 51 | } |
| 53 | 52 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function removePrefixes($string, array $prefixes) |
| 104 | 104 | { |
| 105 | - return array_reduce($prefixes, function ($string, $prefix) { |
|
| 105 | + return array_reduce($prefixes, function($string, $prefix) { |
|
| 106 | 106 | return Strings::removePrefix($string, $prefix); |
| 107 | 107 | }, $string); |
| 108 | 108 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | public static function htmlEntities($text) |
| 331 | 331 | { |
| 332 | 332 | $flag = defined('ENT_SUBSTITUTE') ? ENT_SUBSTITUTE : ENT_IGNORE; |
| 333 | - $htmlentities = htmlentities($text, ENT_COMPAT | $flag, 'UTF-8'); |
|
| 333 | + $htmlentities = htmlentities($text, ENT_COMPAT|$flag, 'UTF-8'); |
|
| 334 | 334 | $htmlentities = str_replace(array('Ó', 'ó'), array('Ó', 'ó'), $htmlentities); |
| 335 | 335 | return $htmlentities; |
| 336 | 336 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public static function flatten(array $array) |
| 123 | 123 | { |
| 124 | 124 | $return = array(); |
| 125 | - array_walk_recursive($array, function ($a) use (&$return) { |
|
| 125 | + array_walk_recursive($array, function($a) use (&$return) { |
|
| 126 | 126 | $return[] = $a; |
| 127 | 127 | }); |
| 128 | 128 | return $return; |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | public static function orderBy(array $elements, $orderField) |
| 458 | 458 | { |
| 459 | - usort($elements, function ($a, $b) use ($orderField) { |
|
| 459 | + usort($elements, function($a, $b) use ($orderField) { |
|
| 460 | 460 | return $a->$orderField < $b->$orderField ? -1 : 1; |
| 461 | 461 | }); |
| 462 | 462 | return $elements; |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | public static function hasNestedKey(array $array, array $keys, $flags = null) |
| 893 | 893 | { |
| 894 | 894 | foreach ($keys as $key) { |
| 895 | - if (!array_key_exists($key, $array) || (!($flags & self::TREAT_NULL_AS_VALUE) && !isset($array[$key]))) { |
|
| 895 | + if (!array_key_exists($key, $array) || (!($flags&self::TREAT_NULL_AS_VALUE) && !isset($array[$key]))) { |
|
| 896 | 896 | return false; |
| 897 | 897 | } |
| 898 | 898 | $array = self::getValue($array, $key); |
@@ -53,14 +53,14 @@ |
||
| 53 | 53 | private static function getClassMethods($class) |
| 54 | 54 | { |
| 55 | 55 | $methods = $class->getMethods(); |
| 56 | - return Arrays::filter($methods, function (ReflectionMethod $method) { |
|
| 56 | + return Arrays::filter($methods, function(ReflectionMethod $method) { |
|
| 57 | 57 | return !$method->isConstructor(); |
| 58 | 58 | }); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | private static function getParameterDeclaration(ReflectionFunctionAbstract $method) |
| 62 | 62 | { |
| 63 | - return Joiner::on(', ')->join(Arrays::map($method->getParameters(), function (ReflectionParameter $param) { |
|
| 63 | + return Joiner::on(', ')->join(Arrays::map($method->getParameters(), function(ReflectionParameter $param) { |
|
| 64 | 64 | $result = ''; |
| 65 | 65 | if ($param->getClass()) { |
| 66 | 66 | $result .= $param->getClass()->getName() . ' '; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function __get($field) |
| 23 | 23 | { |
| 24 | - $this->_operations[] = function ($input) use ($field) { |
|
| 24 | + $this->_operations[] = function($input) use ($field) { |
|
| 25 | 25 | return Objects::getValue($input, $field); |
| 26 | 26 | }; |
| 27 | 27 | return $this; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function __call($name, $arguments) |
| 31 | 31 | { |
| 32 | - $this->_operations[] = function ($input) use ($name, $arguments) { |
|
| 32 | + $this->_operations[] = function($input) use ($name, $arguments) { |
|
| 33 | 33 | return call_user_func_array(array($input, $name), $arguments); |
| 34 | 34 | }; |
| 35 | 35 | return $this; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function offsetGet($offset) |
| 50 | 50 | { |
| 51 | - $this->_operations[] = function ($input) use ($offset) { |
|
| 51 | + $this->_operations[] = function($input) use ($offset) { |
|
| 52 | 52 | return isset($input[$offset]) ? $input[$offset] : null; |
| 53 | 53 | }; |
| 54 | 54 | return $this; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function negate() |
| 49 | 49 | { |
| 50 | - $this->_functions[] = function ($object) { |
|
| 50 | + $this->_functions[] = function($object) { |
|
| 51 | 51 | return !$object; |
| 52 | 52 | }; |
| 53 | 53 | return $this; |
@@ -11,21 +11,21 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public static function extractId() |
| 13 | 13 | { |
| 14 | - return function ($object) { |
|
| 14 | + return function($object) { |
|
| 15 | 15 | return $object->getId(); |
| 16 | 16 | }; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public static function extractField($name, $accessPrivate = false) |
| 20 | 20 | { |
| 21 | - return function ($object) use ($name, $accessPrivate) { |
|
| 21 | + return function($object) use ($name, $accessPrivate) { |
|
| 22 | 22 | return Objects::getValue($object, $name, null, $accessPrivate); |
| 23 | 23 | }; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function extractFieldRecursively($names, $accessPrivate = false) |
| 27 | 27 | { |
| 28 | - return function ($object) use ($names, $accessPrivate) { |
|
| 28 | + return function($object) use ($names, $accessPrivate) { |
|
| 29 | 29 | return Objects::getValueRecursively($object, $names, null, $accessPrivate); |
| 30 | 30 | }; |
| 31 | 31 | } |
@@ -43,98 +43,98 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public static function identity() |
| 45 | 45 | { |
| 46 | - return function ($object) { |
|
| 46 | + return function($object) { |
|
| 47 | 47 | return $object; |
| 48 | 48 | }; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public static function constant($value) |
| 52 | 52 | { |
| 53 | - return function () use ($value) { |
|
| 53 | + return function() use ($value) { |
|
| 54 | 54 | return $value; |
| 55 | 55 | }; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public static function throwException(Exception $exception) |
| 59 | 59 | { |
| 60 | - return function () use ($exception) { |
|
| 60 | + return function() use ($exception) { |
|
| 61 | 61 | throw $exception; |
| 62 | 62 | }; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public static function trim() |
| 66 | 66 | { |
| 67 | - return function ($string) { |
|
| 67 | + return function($string) { |
|
| 68 | 68 | return trim($string); |
| 69 | 69 | }; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public static function not($predicate) |
| 73 | 73 | { |
| 74 | - return function ($object) use ($predicate) { |
|
| 74 | + return function($object) use ($predicate) { |
|
| 75 | 75 | return !$predicate($object); |
| 76 | 76 | }; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public static function isArray() |
| 80 | 80 | { |
| 81 | - return function ($object) { |
|
| 81 | + return function($object) { |
|
| 82 | 82 | return is_array($object); |
| 83 | 83 | }; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public static function isInstanceOf($type) |
| 87 | 87 | { |
| 88 | - return function ($object) use ($type) { |
|
| 88 | + return function($object) use ($type) { |
|
| 89 | 89 | return $object instanceof $type; |
| 90 | 90 | }; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public static function prepend($prefix) |
| 94 | 94 | { |
| 95 | - return function ($string) use ($prefix) { |
|
| 95 | + return function($string) use ($prefix) { |
|
| 96 | 96 | return $prefix . $string; |
| 97 | 97 | }; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public static function append($suffix) |
| 101 | 101 | { |
| 102 | - return function ($string) use ($suffix) { |
|
| 102 | + return function($string) use ($suffix) { |
|
| 103 | 103 | return $string . $suffix; |
| 104 | 104 | }; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public static function notEmpty() |
| 108 | 108 | { |
| 109 | - return function ($object) { |
|
| 109 | + return function($object) { |
|
| 110 | 110 | return !empty($object); |
| 111 | 111 | }; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public static function notBlank() |
| 115 | 115 | { |
| 116 | - return function ($string) { |
|
| 116 | + return function($string) { |
|
| 117 | 117 | return Strings::isNotBlank($string); |
| 118 | 118 | }; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public static function removePrefix($prefix) |
| 122 | 122 | { |
| 123 | - return function ($string) use ($prefix) { |
|
| 123 | + return function($string) use ($prefix) { |
|
| 124 | 124 | return Strings::removePrefix($string, $prefix); |
| 125 | 125 | }; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public static function startsWith($prefix) |
| 129 | 129 | { |
| 130 | - return function ($string) use ($prefix) { |
|
| 130 | + return function($string) use ($prefix) { |
|
| 131 | 131 | return Strings::startsWith($string, $prefix); |
| 132 | 132 | }; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public static function formatDateTime($format = Date::DEFAULT_TIME_FORMAT) |
| 136 | 136 | { |
| 137 | - return function ($date) use ($format) { |
|
| 137 | + return function($date) use ($format) { |
|
| 138 | 138 | return Date::formatDateTime($date, $format); |
| 139 | 139 | }; |
| 140 | 140 | } |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public static function compose($functionA, $functionB) |
| 155 | 155 | { |
| 156 | - return function ($input) use ($functionA, $functionB) { |
|
| 156 | + return function($input) use ($functionA, $functionB) { |
|
| 157 | 157 | return Functions::call($functionA, Functions::call($functionB, $input)); |
| 158 | 158 | }; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public static function toString() |
| 162 | 162 | { |
| 163 | - return function ($object) { |
|
| 163 | + return function($object) { |
|
| 164 | 164 | return Objects::toString($object); |
| 165 | 165 | }; |
| 166 | 166 | } |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public static function surroundWith($character) |
| 178 | 178 | { |
| 179 | - return function ($string) use ($character) { |
|
| 179 | + return function($string) use ($character) { |
|
| 180 | 180 | return $character . $string . $character; |
| 181 | 181 | }; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | public static function equals($object) |
| 185 | 185 | { |
| 186 | - return function ($value) use ($object) { |
|
| 186 | + return function($value) use ($object) { |
|
| 187 | 187 | return $value == $object; |
| 188 | 188 | }; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | public static function notEquals($object) |
| 192 | 192 | { |
| 193 | - return function ($value) use ($object) { |
|
| 193 | + return function($value) use ($object) { |
|
| 194 | 194 | return $value != $object; |
| 195 | 195 | }; |
| 196 | 196 | } |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | |
| 117 | 117 | public function firstOr($default) |
| 118 | 118 | { |
| 119 | - return Arrays::firstOrNull($this->_array) ? : $default; |
|
| 119 | + return Arrays::firstOrNull($this->_array) ?: $default; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function toJson() |
@@ -186,7 +186,7 @@ |
||
| 186 | 186 | */ |
| 187 | 187 | protected function getClassPropertiesInLowerCaseUnderscored($className) |
| 188 | 188 | { |
| 189 | - return array_map(function ($value) { |
|
| 189 | + return array_map(function($value) { |
|
| 190 | 190 | return GeneralUtility::camelCaseToLowerCaseUnderscored($value); |
| 191 | 191 | }, ReflectionUtility::getDeclaringProperties($className)); |
| 192 | 192 | } |