Completed
Push — master ( 4066ce...b4c895 )
by Sebastian
03:10
created

AbstractNumber   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A sanitize() 0 8 2
1
<?php
2
3
/**
4
 * Linna Filter
5
 *
6
 * @author Sebastian Rapetti <[email protected]>
7
 * @copyright (c) 2018, Sebastian Rapetti
8
 * @license http://opensource.org/licenses/MIT MIT License
9
 */
10
declare(strict_types = 1);
11
12
namespace Linna\Filter\Rules;
13
14
/**
15
 * Abstract Number
16
 */
17
class AbstractNumber
18
{
19
    /**
20
     * Sanitize.
21
     *
22
     * @param mixed $value
23
     */
24 49
    public function sanitize(&$value): void
25
    {
26 49
        if (fmod((float) $value, 1.0) === 0.0) {
27 44
            settype($value, 'integer');
28 44
            return;
29
        }
30
31 5
        settype($value, 'float');
32 5
    }
33
}
34