Conditions | 8 |
Paths | 40 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
58 | protected function shift(float $number, int $shift): float |
||
59 | { |
||
60 | if ($shift > $this->max) { |
||
61 | $shift %= ($this->max - $this->min + 1); |
||
62 | } |
||
63 | |||
64 | $shift = $shift === 0 ? (int)(7 / 100 * $this->max) : $shift; |
||
65 | |||
66 | $result = $number + $shift <= $this->max ? |
||
67 | $number + $shift : |
||
68 | $this->min + ($number + $shift - $this->max) - 1; |
||
69 | |||
70 | if ($result < $this->min || $result > $this->max) { |
||
71 | $float = round(($this->min / ($this->max + 1)) + M_PI, 5); |
||
72 | $percent = (int)mb_substr((string)$float, -2, 2); |
||
73 | $result = ($this->min === 0 ? $this->max / 2 : $this->min) + ($percent / 100 * $this->min); |
||
74 | $result = $result > $this->max ? $this->max : $result; |
||
75 | } |
||
76 | |||
77 | return $result; |
||
78 | } |
||
93 |