@@ -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 | |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | - public function __construct(array $intervals = [], bool $preSorted = false) |
|
| 23 | + public function __construct(array $intervals = [ ], bool $preSorted = false) |
|
| 24 | 24 | { |
| 25 | - !$preSorted && usort($intervals, function (IntervalInterface $i0, IntervalInterface $i) { |
|
| 25 | + !$preSorted && usort($intervals, function(IntervalInterface $i0, IntervalInterface $i) { |
|
| 26 | 26 | return $i0->getStart() <=> $i->getStart(); |
| 27 | 27 | }); |
| 28 | 28 | $this->root = $this->toTree($intervals); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - array_walk($intervals, function (IntervalInterface $el) use (&$max) { |
|
| 46 | + array_walk($intervals, function(IntervalInterface $el) use (&$max) { |
|
| 47 | 47 | if ($max < $el->getEnd()) { |
| 48 | 48 | $max = $el->getEnd(); |
| 49 | 49 | } |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function select(int $low, int $high): array |
| 74 | 74 | { |
| 75 | - return $this->root ? $this->root->select($low, $high) : []; |
|
| 75 | + return $this->root ? $this->root->select($low, $high) : [ ]; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function selectNode(int $low, int $high): array |
| 79 | 79 | { |
| 80 | - return $this->root ? $this->root->selectNode($low, $high) : []; |
|
| 80 | + return $this->root ? $this->root->selectNode($low, $high) : [ ]; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $arr = $this->all(); |
| 97 | 97 | |
| 98 | - usort($arr, function (IntervalInterface $i0, IntervalInterface $i) { |
|
| 98 | + usort($arr, function(IntervalInterface $i0, IntervalInterface $i) { |
|
| 99 | 99 | return $i0->getStart() <=> $i->getStart(); |
| 100 | 100 | }); |
| 101 | 101 | |
@@ -104,22 +104,22 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function yieldInterSelect(int $low, int $high) |
| 106 | 106 | { |
| 107 | - return $this->root ? $this->root->yieldInterSelect($low, $high) : []; |
|
| 107 | + return $this->root ? $this->root->yieldInterSelect($low, $high) : [ ]; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function interSelectNode(int $low, int $high): array |
| 111 | 111 | { |
| 112 | - return $this->root ? $this->root->interSelectNode($low, $high) : []; |
|
| 112 | + return $this->root ? $this->root->interSelectNode($low, $high) : [ ]; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function interSelect(int $low, int $high): array |
| 116 | 116 | { |
| 117 | - return $this->root ? $this->root->interSelect($low, $high) : []; |
|
| 117 | + return $this->root ? $this->root->interSelect($low, $high) : [ ]; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function yieldSelect(int $low, int $high) |
| 121 | 121 | { |
| 122 | - return $this->root ? $this->root->yieldSelect($low, $high) : []; |
|
| 122 | + return $this->root ? $this->root->yieldSelect($low, $high) : [ ]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function all(): array |
| 129 | 129 | { |
| 130 | - return $this->root ? $this->root->all() : []; |
|
| 130 | + return $this->root ? $this->root->all() : [ ]; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function yieldAll() |
| 139 | 139 | { |
| 140 | - return $this->root ? $this->root->yieldAll() : []; |
|
| 140 | + return $this->root ? $this->root->yieldAll() : [ ]; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function removeRegion(int $low, int $high) |
| 144 | 144 | { |
| 145 | 145 | if (!$this->root) { |
| 146 | - return []; |
|
| 146 | + return [ ]; |
|
| 147 | 147 | } |
| 148 | - foreach($this->interSelectNode($low, $high) as $node) { |
|
| 148 | + foreach ($this->interSelectNode($low, $high) as $node) { |
|
| 149 | 149 | $this->remove($node); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | return; |
| 190 | 190 | if (!$this->root) { |
| 191 | - return []; |
|
| 191 | + return [ ]; |
|
| 192 | 192 | } |
| 193 | 193 | $this->root->remove($i); |
| 194 | 194 | } |