| Conditions | 7 |
| Paths | 16 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public static function gcd($number1) |
||
| 24 | { |
||
| 25 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
||
| 26 | $n = min($numbers); |
||
| 27 | if (in_array(0, $numbers)) { |
||
| 28 | return max($numbers); |
||
| 29 | } |
||
| 30 | for ($i = $n; $i > 1; $i--) { |
||
| 31 | $isFind = true; |
||
| 32 | foreach ($numbers as $num) { |
||
| 33 | if (false === is_int($num / $i)) { |
||
| 34 | $isFind = false; |
||
| 35 | break; |
||
| 36 | } |
||
| 37 | } |
||
| 38 | if (true === $isFind) { |
||
| 39 | return $i; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | return 1; |
||
| 43 | } |
||
| 45 |