@@ -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 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function __construct(array $intervals, bool $preSorted = false) |
| 21 | 21 | { |
| 22 | - !$preSorted && usort($intervals, function (IntervalInterface $i0, IntervalInterface $i) { |
|
| 22 | + !$preSorted && usort($intervals, function(IntervalInterface $i0, IntervalInterface $i) { |
|
| 23 | 23 | return $i0->getStart() <=> $i->getStart(); |
| 24 | 24 | }); |
| 25 | 25 | $this->root = $this->toTree($intervals); |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $max = 0; |
| 36 | 36 | $len = count($intervals); |
| 37 | - $mid = (int)floor($len / 2); |
|
| 37 | + $mid = (int) floor($len / 2); |
|
| 38 | 38 | |
| 39 | 39 | if (!$len) { |
| 40 | 40 | return null; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - array_walk($intervals, function (IntervalInterface $el) use (&$max) { |
|
| 43 | + array_walk($intervals, function(IntervalInterface $el) use (&$max) { |
|
| 44 | 44 | if ($max < $el->getEnd()) { |
| 45 | 45 | $max = $el->getEnd(); |
| 46 | 46 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function select(int $low, int $high): array |
| 68 | 68 | { |
| 69 | - return $this->root ? $this->root->select($low, $high) : []; |
|
| 69 | + return $this->root ? $this->root->select($low, $high) : [ ]; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $arr = $this->all(); |
| 78 | 78 | |
| 79 | - usort($arr, function (IntervalInterface $i0, IntervalInterface $i) { |
|
| 79 | + usort($arr, function(IntervalInterface $i0, IntervalInterface $i) { |
|
| 80 | 80 | return $i0->getStart() <=> $i->getStart(); |
| 81 | 81 | }); |
| 82 | 82 | |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function interSelect(int $low, int $high): array |
| 87 | 87 | { |
| 88 | - return $this->root ? $this->root->interSelect($low, $high) : []; |
|
| 88 | + return $this->root ? $this->root->interSelect($low, $high) : [ ]; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function yieldSelect(int $low, int $high) |
| 92 | 92 | { |
| 93 | - return $this->root ? $this->root->yieldSelect($low, $high) : []; |
|
| 93 | + return $this->root ? $this->root->yieldSelect($low, $high) : [ ]; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function all(): array |
| 101 | 101 | { |
| 102 | - return $this->root ? $this->root->all() : []; |
|
| 102 | + return $this->root ? $this->root->all() : [ ]; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -109,6 +109,6 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function yieldAll() |
| 111 | 111 | { |
| 112 | - return $this->root ? $this->root->yieldAll() : []; |
|
| 112 | + return $this->root ? $this->root->yieldAll() : [ ]; |
|
| 113 | 113 | } |
| 114 | 114 | } |