@@ -95,7 +95,7 @@ |
||
| 95 | 95 | public function orderGroups() : array { |
| 96 | 96 | $groups = $this->getGroups(); |
| 97 | 97 | usort($groups, static function($a, $b) { |
| 98 | - return $a->getOrder() - $b->getOrder(); |
|
| 98 | + return $a->getOrder()-$b->getOrder(); |
|
| 99 | 99 | }); |
| 100 | 100 | return $groups; |
| 101 | 101 | } |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | // Get initial data |
| 49 | 49 | if ($this->topLevelOnly) { |
| 50 | 50 | $data = $this->container->getTopLevel(); |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | $data = $this->container->get(); |
| 54 | 53 | } |
| 55 | 54 | |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | } |
| 65 | 64 | $ids[] = $obj->getId(); |
| 66 | 65 | } |
| 67 | - } |
|
| 68 | - else { |
|
| 66 | + } else { |
|
| 69 | 67 | $data = array_unique($data); |
| 70 | 68 | } |
| 71 | 69 | } |
@@ -78,11 +76,9 @@ discard block |
||
| 78 | 76 | // Sorting |
| 79 | 77 | if (isset($this->sorter)) { |
| 80 | 78 | $data = $this->sorter->sort($data); |
| 81 | - } |
|
| 82 | - elseif (isset($this->sortClosure)) { |
|
| 79 | + } elseif (isset($this->sortClosure)) { |
|
| 83 | 80 | uasort($data, $this->sortClosure); |
| 84 | - } |
|
| 85 | - elseif (isset($this->sortProperty)) { |
|
| 81 | + } elseif (isset($this->sortProperty)) { |
|
| 86 | 82 | uasort($data, [$this, 'sortByPropertyCallback']); |
| 87 | 83 | } |
| 88 | 84 | |
@@ -181,14 +177,12 @@ discard block |
||
| 181 | 177 | $property2 = null; |
| 182 | 178 | if (is_object($value1) && isset($value1->$property)) { |
| 183 | 179 | $property1 = $value1->$property; |
| 184 | - } |
|
| 185 | - elseif (is_array($value1) && isset($value1[$property])) { |
|
| 180 | + } elseif (is_array($value1) && isset($value1[$property])) { |
|
| 186 | 181 | $property1 = $value1[$property]; |
| 187 | 182 | } |
| 188 | 183 | if (is_object($value2) && isset($value2->$property)) { |
| 189 | 184 | $property2 = $value2->$property; |
| 190 | - } |
|
| 191 | - elseif (is_array($value2) && isset($value2[$property])) { |
|
| 185 | + } elseif (is_array($value2) && isset($value2[$property])) { |
|
| 192 | 186 | $property2 = $value2[$property]; |
| 193 | 187 | } |
| 194 | 188 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return bool |
| 24 | 24 | */ |
| 25 | 25 | public static function isPowerOf2(int $x) : bool { |
| 26 | - return ($x !== 0) && ($x & ($x - 1)) === 0; |
|
| 26 | + return ($x !== 0) && ($x&($x-1)) === 0; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public static function previousPowerOf2(int $x) : int { |
| 49 | 49 | // Left bit shift by the bit length of the previous number |
| 50 | - return 1 << (strlen(decbin($x)) - 1); |
|
| 50 | + return 1 << (strlen(decbin($x))-1); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | $data['categories'] = [ |
| 104 | 104 | $this->object->getId() => $this->getCategoryData($this->object), |
| 105 | 105 | ]; |
| 106 | - } |
|
| 107 | - elseif ($this->object instanceof WithCategories) { |
|
| 106 | + } elseif ($this->object instanceof WithCategories) { |
|
| 108 | 107 | $data['categories'] = []; |
| 109 | 108 | foreach ($this->object->getCategories() as $category) { |
| 110 | 109 | $data['categories'][$category->getId()] = $this->getCategoryData($category); |
@@ -141,8 +140,7 @@ discard block |
||
| 141 | 140 | $data['rounds'] = [ |
| 142 | 141 | $this->object->getId() => $this->getRoundData($this->object), |
| 143 | 142 | ]; |
| 144 | - } |
|
| 145 | - elseif ($this->object instanceof WithRounds) { |
|
| 143 | + } elseif ($this->object instanceof WithRounds) { |
|
| 146 | 144 | $data['rounds'] = []; |
| 147 | 145 | foreach ($this->object->getRounds() as $round) { |
| 148 | 146 | $data['rounds'][$round->getId()] = $this->getRoundData($round); |
@@ -182,8 +180,7 @@ discard block |
||
| 182 | 180 | foreach ($this->object->getProgressions() as $progression) { |
| 183 | 181 | $data['progressions'][] = $this->getProgressionData($progression); |
| 184 | 182 | } |
| 185 | - } |
|
| 186 | - elseif ($this->object instanceof WithGroups) { |
|
| 183 | + } elseif ($this->object instanceof WithGroups) { |
|
| 187 | 184 | foreach ($this->object->getGroups() as $group) { |
| 188 | 185 | $data['groups'][$group->getId()] = $this->getGroupData($group); |
| 189 | 186 | foreach ($group->getProgressions() as $progression) { |