GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#20)
by t
02:32
created

GMAT   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 29
ccs 14
cts 14
cp 1
rs 10
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
B gcd() 0 20 7
1
<?php
2
/**
3
 * Trait MathAndTrigonometry-G
4
 *
5
 * @link https://www.icy2003.com/
6
 * @author icy2003 <[email protected]>
7
 * @copyright Copyright (c) 2017, icy2003
8
 */
9
namespace icy2003\php\icomponents\excel\mathAndTrigonometry;
10
11
/**
12
 * MathAndTrigonometry-G
13
 */
14
trait GMAT
15
{
16
    /**
17
     * 返回两个或多个整数的最大公约数。 最大公约数是能够同时整除 number1 和 number2 而没有余数的最大整数
18
     *
19
     * @param integer|array $number1 Number1 是必需的,后续数字是可选的。 介于 1 和 255 之间的值
20
     *
21
     * @return integer
22
     */
23 2
    public static function gcd($number1)
24
    {
25 2
        $numbers = is_array($number1) ? $number1 : func_get_args();
26 2
        $n = min($numbers);
27 2
        if (in_array(0, $numbers)) {
28 1
            return max($numbers);
29
        }
30 2
        for ($i = $n; $i > 1; $i--) {
31 2
            $isFind = true;
32 2
            foreach ($numbers as $num) {
33 2
                if (false === is_int($num / $i)) {
34 2
                    $isFind = false;
35 2
                    break;
36
                }
37
            }
38 2
            if (true === $isFind) {
39 2
                return $i;
40
            }
41
        }
42 2
        return 1;
43
    }
44
}
45