Conditions | 4 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
108 | 3 | private function getFactors($number): array |
|
109 | { |
||
110 | 3 | $factors = []; |
|
111 | |||
112 | 3 | for ($i = 2; $number / $i >= $i; ++$i) { |
|
113 | 3 | while (0 === $number % $i) { |
|
114 | 2 | $factors[] = $i; |
|
115 | 2 | $number /= $i; |
|
116 | } |
||
117 | } |
||
118 | |||
119 | 3 | if (1 < $number) { |
|
120 | 2 | $factors[] = $number; |
|
121 | } |
||
122 | |||
123 | 3 | return $factors; |
|
124 | } |
||
126 |