Number::filter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of slick/filter package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Filter;
11
12
/**
13
 * Number filter
14
 *
15
 * @package Slick\Filter
16
 * @author  Filipe Silva <[email protected]>
17
 */
18
class Number implements FilterInterface
19
{
20
21
    /**
22
     * Returns the result of filtering $value
23
     *
24
     * @param mixed $value
25
     *
26
     * @throws Exception\CannotFilterValueException
27
     *      If filtering $value is impossible.
28
     *
29
     * @return mixed
30
     */
31 4
    public function filter($value)
32
    {
33 4
        return filter_var($value, FILTER_SANITIZE_NUMBER_INT);
34
    }
35
}