Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | 1 | class Normalizer implements NormalizerInterface |
|
10 | { |
||
11 | private float $scaleBottom; |
||
12 | private float $scaleTop; |
||
13 | |||
14 | 6 | public function __construct( |
|
15 | float $scaleBottom = 1, |
||
16 | float $scaleTop = 10 |
||
17 | ) { |
||
18 | 6 | $this->scaleBottom = $scaleBottom; |
|
19 | 6 | $this->scaleTop = $scaleTop; |
|
20 | 6 | } |
|
21 | |||
22 | 5 | public function normalize( |
|
36 | } |
||
37 | 5 | } |
|
38 | |||
39 | 5 | private function getDivider(float $lowestRank, float $highestRank): float |
|
40 | { |
||
41 | 5 | $divider = $highestRank - $lowestRank; |
|
42 | |||
43 | 5 | if (.0 === $divider) { |
|
|
|||
44 | 2 | $divider = 1; |
|
45 | } |
||
46 | |||
47 | 5 | return $divider; |
|
48 | } |
||
49 | |||
50 | 5 | private function getScaledRank( |
|
59 | } |
||
60 | } |
||
61 |