@@ -85,25 +85,20 @@ discard block |
||
| 85 | 85 | $this->buckets = array(array($value, $value, 1, $meta)); |
| 86 | 86 | $this->min = $this->max = $value; |
| 87 | 87 | $this->totalBuckets = 1; |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | if ($value < $this->min) { |
| 91 | 90 | $this->min = $value; |
| 92 | 91 | array_unshift($this->buckets, array($value, $value, 1, $meta)); |
| 93 | 92 | $this->totalBuckets++; |
| 94 | - } |
|
| 95 | - elseif ($value > $this->max) { |
|
| 93 | + } elseif ($value > $this->max) { |
|
| 96 | 94 | $this->max = $value; |
| 97 | 95 | array_push($this->buckets, array($value, $value, 1, $meta)); |
| 98 | 96 | $this->totalBuckets++; |
| 99 | - } |
|
| 100 | - elseif ($value === $this->min) { |
|
| 97 | + } elseif ($value === $this->min) { |
|
| 101 | 98 | ++$this->buckets[0][2]; |
| 102 | - } |
|
| 103 | - elseif ($value === $this->max) { |
|
| 99 | + } elseif ($value === $this->max) { |
|
| 104 | 100 | ++$this->buckets[$this->totalBuckets - 1][2]; |
| 105 | - } |
|
| 106 | - else { |
|
| 101 | + } else { |
|
| 107 | 102 | $this->insert($value, $meta); |
| 108 | 103 | } |
| 109 | 104 | } |
@@ -121,11 +116,9 @@ discard block |
||
| 121 | 116 | $item = $this->buckets[$position]; |
| 122 | 117 | if ($value < $item[0]) { |
| 123 | 118 | $right = $position - 1; |
| 124 | - } |
|
| 125 | - elseif ($value > $item[1]) { |
|
| 119 | + } elseif ($value > $item[1]) { |
|
| 126 | 120 | $left = $position + 1; |
| 127 | - } |
|
| 128 | - else { |
|
| 121 | + } else { |
|
| 129 | 122 | ++$this->buckets[$position][2]; |
| 130 | 123 | return; |
| 131 | 124 | } |
@@ -136,12 +129,10 @@ discard block |
||
| 136 | 129 | if ($value < $item[0]) { |
| 137 | 130 | array_splice($this->buckets, $position, 0, array(array($value, $value, 1, $meta))); |
| 138 | 131 | ++$this->totalBuckets; |
| 139 | - } |
|
| 140 | - elseif ($value > $item[1]) { |
|
| 132 | + } elseif ($value > $item[1]) { |
|
| 141 | 133 | array_splice($this->buckets, $position + 1, 0, array(array($value, $value, 1, $meta))); |
| 142 | 134 | ++$this->totalBuckets; |
| 143 | - } |
|
| 144 | - else { |
|
| 135 | + } else { |
|
| 145 | 136 | ++$this->buckets[$position][2]; |
| 146 | 137 | } |
| 147 | 138 | } |
@@ -157,8 +148,7 @@ discard block |
||
| 157 | 148 | $currentCount = $this->buckets[$position][2]; |
| 158 | 149 | if ($position === $this->totalBuckets - 1) { |
| 159 | 150 | $currentMergePosition = $position - 1; |
| 160 | - } |
|
| 161 | - else { |
|
| 151 | + } else { |
|
| 162 | 152 | $currentMergePosition = $this->buckets[$position + 1][2] < $this->buckets[$position - 1][2] |
| 163 | 153 | ? $position + 1 |
| 164 | 154 | : $position - 1; |
@@ -176,8 +166,7 @@ discard block |
||
| 176 | 166 | |
| 177 | 167 | if ($mergePosition > $minPosition) { |
| 178 | 168 | $this->buckets[$minPosition][1] = $this->buckets[$mergePosition][1]; |
| 179 | - } |
|
| 180 | - else { |
|
| 169 | + } else { |
|
| 181 | 170 | $this->buckets[$minPosition][0] = $this->buckets[$mergePosition][0]; |
| 182 | 171 | } |
| 183 | 172 | $this->buckets[$minPosition][2] += $this->buckets[$mergePosition][2]; |