@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace MartanLV\Koki; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace MartanLV\Koki; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace MartanLV\Koki; |
| 5 | 5 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace MartanLV\Koki; |
| 6 | 6 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return void |
| 23 | 23 | */ |
| 24 | - public function __construct(array $intervals = [], bool $preSorted = false) |
|
| 24 | + public function __construct(array $intervals = [ ], bool $preSorted = false) |
|
| 25 | 25 | { |
| 26 | - !$preSorted && usort($intervals, function (IntervalInterface $i0, IntervalInterface $i) { |
|
| 26 | + !$preSorted && usort($intervals, function(IntervalInterface $i0, IntervalInterface $i) { |
|
| 27 | 27 | return $i0->getStart() <=> $i->getStart(); |
| 28 | 28 | }); |
| 29 | 29 | $this->root = $this->toTree($intervals); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - array_walk($intervals, function (IntervalInterface $el) use (&$max) { |
|
| 47 | + array_walk($intervals, function(IntervalInterface $el) use (&$max) { |
|
| 48 | 48 | if ($max < $el->getEnd()) { |
| 49 | 49 | $max = $el->getEnd(); |
| 50 | 50 | } |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function select(int $low, int $high): array |
| 76 | 76 | { |
| 77 | - return $this->root ? $this->root->select($low, $high) : []; |
|
| 77 | + return $this->root ? $this->root->select($low, $high) : [ ]; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function selectNode(int $low, int $high): array |
| 81 | 81 | { |
| 82 | - return $this->root ? $this->root->selectNode($low, $high) : []; |
|
| 82 | + return $this->root ? $this->root->selectNode($low, $high) : [ ]; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $arr = $this->all(); |
| 99 | 99 | |
| 100 | - usort($arr, function (IntervalInterface $i0, IntervalInterface $i) { |
|
| 100 | + usort($arr, function(IntervalInterface $i0, IntervalInterface $i) { |
|
| 101 | 101 | return $i0->getStart() <=> $i->getStart(); |
| 102 | 102 | }); |
| 103 | 103 | |
@@ -106,22 +106,22 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function yieldInterSelect(int $low, int $high) |
| 108 | 108 | { |
| 109 | - return $this->root ? $this->root->yieldInterSelect($low, $high) : []; |
|
| 109 | + return $this->root ? $this->root->yieldInterSelect($low, $high) : [ ]; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function interSelectNode(int $low, int $high): array |
| 113 | 113 | { |
| 114 | - return $this->root ? $this->root->interSelectNode($low, $high) : []; |
|
| 114 | + return $this->root ? $this->root->interSelectNode($low, $high) : [ ]; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function interSelect(int $low, int $high): array |
| 118 | 118 | { |
| 119 | - return $this->root ? $this->root->interSelect($low, $high) : []; |
|
| 119 | + return $this->root ? $this->root->interSelect($low, $high) : [ ]; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function yieldSelect(int $low, int $high) |
| 123 | 123 | { |
| 124 | - return $this->root ? $this->root->yieldSelect($low, $high) : []; |
|
| 124 | + return $this->root ? $this->root->yieldSelect($low, $high) : [ ]; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function all(): array |
| 131 | 131 | { |
| 132 | - return $this->root ? $this->root->all() : []; |
|
| 132 | + return $this->root ? $this->root->all() : [ ]; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function yieldAll() |
| 141 | 141 | { |
| 142 | - return $this->root ? $this->root->yieldAll() : []; |
|
| 142 | + return $this->root ? $this->root->yieldAll() : [ ]; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function removeRegion(int $low, int $high) |
| 146 | 146 | { |
| 147 | 147 | if (!$this->root) { |
| 148 | - return []; |
|
| 148 | + return [ ]; |
|
| 149 | 149 | } |
| 150 | 150 | foreach ($this->interSelectNode($low, $high) as $node) { |
| 151 | 151 | $this->remove($node); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | return; |
| 193 | 193 | if (!$this->root) { |
| 194 | - return []; |
|
| 194 | + return [ ]; |
|
| 195 | 195 | } |
| 196 | 196 | $this->root->remove($i); |
| 197 | 197 | } |