Passed
Push — master ( 4b8292...9204d2 )
by Mark
10:15
created

Cosecant   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A csch() 0 9 2
A csc() 0 9 2
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig;
4
5
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
6
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers;
7
8
class Cosecant
9
{
10
    /**
11
     * CSC.
12
     *
13
     * Returns the cosecant of an angle.
14
     *
15
     * @param float $angle Number
16
     *
17
     * @return float|string The cosecant of the angle
18
     */
19 18
    public static function csc($angle)
20
    {
21
        try {
22 18
            $angle = Helpers::validateNumericNullBool($angle);
23 1
        } catch (Exception $e) {
24 1
            return $e->getMessage();
25
        }
26
27 17
        return Helpers::verySmallDenominator(1.0, sin($angle));
28
    }
29
30
    /**
31
     * CSCH.
32
     *
33
     * Returns the hyperbolic cosecant of an angle.
34
     *
35
     * @param float $angle Number
36
     *
37
     * @return float|string The hyperbolic cosecant of the angle
38
     */
39 20
    public static function csch($angle)
40
    {
41
        try {
42 20
            $angle = Helpers::validateNumericNullBool($angle);
43 1
        } catch (Exception $e) {
44 1
            return $e->getMessage();
45
        }
46
47 19
        return Helpers::verySmallDenominator(1.0, sinh($angle));
48
    }
49
}
50