Number::process()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Faulancer\Form\Validator\Base;
4
5
use Faulancer\Form\Validator\AbstractValidator;
6
7
/**
8
 * Class Number
9
 *
10
 * @package Faulancer\Form\Validator\Base
11
 * @author Florian Knapp <[email protected]>
12
 */
13
class Number extends AbstractValidator
14
{
15
16
    /**
17
     * The error message as key for translation
18
     * @var string
19
     */
20
    protected $errorMessage = 'validator_invalid_number';
21
22
    /**
23
     * Validate type number
24
     *
25
     * @param string $data
26
     *
27
     * @return bool
28
     */
29
    public function process($data)
30
    {
31
        return !!preg_match('/([0-9\/-_.]+)/', $data);
32
    }
33
34
}