Calculator::sum()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 3
eloc 4
nc 2
nop 2
crap 3
1
<?php
2
/**
3
 * Class Calculator
4
 *
5
 * @package Mwesterink\ServiceChecks\Classes
6
 * @author  Michel Westerink <[email protected]>
7
 */
8
9
namespace Mwesterink\ServiceChecks\Classes;
10
11
class Calculator
12
{
13
    /**
14
     * @param int $firstDigit
15
     * @param int $secondDigit
16
     *
17
     * @return int
18
     * @throws \Exception
19
     */
20 2
    public function sum($firstDigit, $secondDigit)
21
    {
22 2
        if (!is_numeric($firstDigit) || !is_numeric($secondDigit)) {
23 1
            throw new \Exception('One of the digits is not numeric');
24
        }
25
26 1
        return $firstDigit + $secondDigit;
27
    }
28
}
29