Passed
Push — master ( c380b2...9239b3 )
by Adrien
10:06
created

Quotient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A funcQuotient() 0 11 2
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
4
5
use Exception;
6
7
class Quotient
8
{
9
    /**
10
     * QUOTIENT.
11
     *
12
     * QUOTIENT function returns the integer portion of a division. Numerator is the divided number
13
     *        and denominator is the divisor.
14
     *
15
     * Excel Function:
16
     *        QUOTIENT(value1,value2)
17
     *
18
     * @param mixed $numerator Expect float|int
19
     * @param mixed $denominator Expect float|int
20
     *
21
     * @return int|string
22
     */
23 13
    public static function funcQuotient($numerator, $denominator)
24
    {
25
        try {
26 13
            $numerator = Helpers::validateNumericNullSubstitution($numerator, 0);
27 12
            $denominator = Helpers::validateNumericNullSubstitution($denominator, 0);
28 11
            Helpers::validateNotZero($denominator);
29 5
        } catch (Exception $e) {
30 5
            return $e->getMessage();
31
        }
32
33 8
        return (int) ($numerator / $denominator);
34
    }
35
}
36