Integer::filterSingle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.9
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 3
1
<?php
2
declare(strict_types=1);
3
namespace Sirius\Filtration\Filter;
4
5
class Integer extends AbstractFilter
6
{
7 3
    public function filterSingle($value, string $valueIdentifier = null)
8
    {
9 3
        if (is_object($value)) {
10 1
            return $value;
11
        }
12 2
        if ($value == 0) {
13 1
            return 0;
14
        }
15 1
        $value = floatval($value);
16 1
        return (int) $value;
17
    }
18
}
19