@@ -43,7 +43,7 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | private static function sort($results, $sortingArray) |
| 45 | 45 | { |
| 46 | - usort($results, function ($first, $second) use ($sortingArray) { |
|
| 46 | + usort($results, function($first, $second) use ($sortingArray) { |
|
| 47 | 47 | $valueA = self::getArrayElementValueFromKey($sortingArray['key'], $first); |
| 48 | 48 | $valueB = self::getArrayElementValueFromKey($sortingArray['key'], $second); |
| 49 | 49 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | private static function getValueFromKeysArray($keysArray, $arrayElement) |
| 39 | 39 | { |
| 40 | - if (count($keysArray)>1) { |
|
| 40 | + if (count($keysArray) > 1) { |
|
| 41 | 41 | $key = array_shift($keysArray); |
| 42 | 42 | |
| 43 | 43 | return self::getValueFromKeysArray($keysArray, ArrayHelper::convertToPlainArray($arrayElement[$key])); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if(false === ArrayHelper::compareElementToItemKeyMap($firstItem, $element)) { |
|
| 38 | + if (false === ArrayHelper::compareElementToItemKeyMap($firstItem, $element)) { |
|
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function compareElementToItemKeyMap($itemToCompare, $element) |
| 35 | 35 | { |
| 36 | - foreach ($itemToCompare as $key => $item){ |
|
| 37 | - if(is_array($item) && ArrayHelper::isAnAssociativeArray($item)){ |
|
| 36 | + foreach ($itemToCompare as $key => $item) { |
|
| 37 | + if (is_array($item) && ArrayHelper::isAnAssociativeArray($item)) { |
|
| 38 | 38 | if (false === ArrayHelper::checkIfTwoArraysAreConsistent(array_keys($item), array_keys($element[$key]))) { |
| 39 | 39 | return false; |
| 40 | 40 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | array_shift($key); |
| 92 | 92 | $value = $array[$key[0]]; |
| 93 | 93 | |
| 94 | - if(is_array($value)){ |
|
| 94 | + if (is_array($value)) { |
|
| 95 | 95 | return self::getValueFromNestedArray($key, $value); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -106,6 +106,6 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | if ([] === $array) return false; |
| 108 | 108 | |
| 109 | - return array_keys($array) !== range(0, count($array) - 1); |
|
| 109 | + return array_keys($array) !== range(0, count($array)-1); |
|
| 110 | 110 | } |
| 111 | 111 | } |
@@ -104,7 +104,9 @@ |
||
| 104 | 104 | */ |
| 105 | 105 | public static function isAnAssociativeArray(array $array) |
| 106 | 106 | { |
| 107 | - if ([] === $array) return false; |
|
| 107 | + if ([] === $array) { |
|
| 108 | + return false; |
|
| 109 | + } |
|
| 108 | 110 | |
| 109 | 111 | return array_keys($array) !== range(0, count($array) - 1); |
| 110 | 112 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function removeElement($key) |
| 113 | 113 | { |
| 114 | - if(!isset($this->array[$key])){ |
|
| 114 | + if (!isset($this->array[$key])) { |
|
| 115 | 115 | throw new NotExistingElementException(sprintf('Element with key %s does not exists.', $key)); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function getResults() |
| 242 | 242 | { |
| 243 | - if(empty($this->array)){ |
|
| 243 | + if (empty($this->array)) { |
|
| 244 | 244 | return []; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -330,12 +330,12 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | foreach ($this->criteria as $criterion) { |
| 332 | 332 | $results = array_filter( |
| 333 | - (isset($results)) ? $results : $array, function ($element) use ($criterion) { |
|
| 333 | + (isset($results)) ? $results : $array, function($element) use ($criterion) { |
|
| 334 | 334 | return CriterionFilter::filter($criterion, $element); |
| 335 | 335 | } |
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | - $results = array_map(function ($result) use ($criterion) { |
|
| 338 | + $results = array_map(function($result) use ($criterion) { |
|
| 339 | 339 | $key = explode(Constants::ALIAS_DELIMITER, $criterion['key']); |
| 340 | 340 | if (count($key) > 1) { |
| 341 | 341 | $oldkey = explode(Constants::ARRAY_SEPARATOR, $key[0]); |