Numbers::filter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Particle.
4
 *
5
 * @link      http://github.com/particle-php for the canonical source repository
6
 * @copyright Copyright (c) 2005-2016 Particle (http://particle-php.com)
7
 * @license   https://github.com/particle-php/Filter/blob/master/LICENSE New BSD License
8
 */
9
namespace Particle\Filter\FilterRule;
10
11
use Particle\Filter\FilterRule;
12
13
/**
14
 * Class Numbers
15
 *
16
 * @package Particle\Filter\FilterRule
17
 */
18
class Numbers extends FilterRule
19
{
20
    /**
21
     * Only return numbers
22
     *
23
     * @param mixed $value
24
     * @return string
25
     */
26 3
    public function filter($value)
27
    {
28 3
        return preg_replace('/\D/', '', $value);
29
    }
30
}
31