@@ -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,17 +85,17 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function yieldInterSelect(int $low, int $high) |
| 87 | 87 | { |
| 88 | - return $this->root ? $this->root->yieldInterSelect($low, $high) : []; |
|
| 88 | + return $this->root ? $this->root->yieldInterSelect($low, $high) : [ ]; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function interSelect(int $low, int $high): array |
| 92 | 92 | { |
| 93 | - return $this->root ? $this->root->interSelect($low, $high) : []; |
|
| 93 | + return $this->root ? $this->root->interSelect($low, $high) : [ ]; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function yieldSelect(int $low, int $high) |
| 97 | 97 | { |
| 98 | - return $this->root ? $this->root->yieldSelect($low, $high) : []; |
|
| 98 | + return $this->root ? $this->root->yieldSelect($low, $high) : [ ]; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function all(): array |
| 106 | 106 | { |
| 107 | - return $this->root ? $this->root->all() : []; |
|
| 107 | + return $this->root ? $this->root->all() : [ ]; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -114,6 +114,6 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function yieldAll() |
| 116 | 116 | { |
| 117 | - return $this->root ? $this->root->yieldAll() : []; |
|
| 117 | + return $this->root ? $this->root->yieldAll() : [ ]; |
|
| 118 | 118 | } |
| 119 | 119 | } |