@@ -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 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function removeElement($key) |
110 | 110 | { |
111 | - if(!isset($this->array[$key])){ |
|
111 | + if (!isset($this->array[$key])) { |
|
112 | 112 | throw new NotExistingElementException(sprintf('Element with key %s does not exists.', $key)); |
113 | 113 | } |
114 | 114 | |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | |
324 | 324 | foreach ($this->criteria as $criterion) { |
325 | 325 | $results = array_filter( |
326 | - (isset($results)) ? $results : $array, function ($element) use ($criterion) { |
|
326 | + (isset($results)) ? $results : $array, function($element) use ($criterion) { |
|
327 | 327 | return CriterionFilter::filter($criterion, $element); |
328 | 328 | } |
329 | 329 | ); |
330 | 330 | |
331 | - $results = array_map(function ($result) use ($criterion) { |
|
331 | + $results = array_map(function($result) use ($criterion) { |
|
332 | 332 | $key = explode(Constants::ALIAS_DELIMITER, $criterion['key']); |
333 | 333 | if (count($key) > 1) { |
334 | 334 | $oldkey = explode(Constants::ARRAY_SEPARATOR, $key[0]); |
@@ -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 | } |