Code Duplication    Length = 13-13 lines in 2 locations

src/Percentiller.php 2 locations

@@ 190-202 (lines=13) @@
187
    }
188
189
190
    public function bottomPercentile($percentile = 0.9) {
191
        $currentCount = 0;
192
        $percentileCount = $this->totalCount * $percentile;
193
        $bucket = array(0, 0, 0);
194
        for ($i = 0; $i < $this->totalBuckets; ++$i) {
195
            $bucket = $this->buckets[$i];
196
            $currentCount += $bucket[2];
197
            if ($currentCount >= $percentileCount) {
198
                return $bucket[1];
199
            }
200
        }
201
        return $bucket[1];
202
    }
203
204
    public function topPercentile($percentile = 0.9) {
205
        $currentCount = 0;
@@ 204-216 (lines=13) @@
201
        return $bucket[1];
202
    }
203
204
    public function topPercentile($percentile = 0.9) {
205
        $currentCount = 0;
206
        $percentileCount = $this->totalCount * $percentile;
207
        $bucket = array(0, 0, 0);
208
        for ($i = $this->totalBuckets - 1; $i >= 0; --$i) {
209
            $bucket = $this->buckets[$i];
210
            $currentCount += $bucket[2];
211
            if ($currentCount >= $percentileCount) {
212
                return $bucket[0];
213
            }
214
        }
215
        return $bucket[0];
216
    }
217
218
    public function getTopValues() {
219
        return array_values($this->topValues);