Completed
Push — master ( b69bd3...8db10c )
by Karsten
01:49
created

IsMultipleOf   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 4
1
<?php
2
/**
3
 * Created by gerk on 01.12.17 23:33
4
 */
5
6
namespace PeekAndPoke\Component\Psi\Psi\Num;
7
8
use PeekAndPoke\Component\Psi\Functions\ParameterizedUnaryFunction;
9
10
/**
11
 *
12
 *
13
 * @author Karsten J. Gerber <[email protected]>
14
 */
15
class IsMultipleOf extends ParameterizedUnaryFunction
16
{
17
    /**
18
     * @param mixed $input
19
     *
20
     * @return bool
21
     */
22 100
    public function __invoke($input)
23
    {
24 100
        $factor = $this->getValue();
25
26 100
        if (! is_numeric($factor) || ! is_numeric($input) || (float) $factor === 0.0) {
27 12
            return false;
28
        }
29
30 88
        return ($input % $factor) === 0;
31
    }
32
}
33