Integer::isValid()   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
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * An Integer field
5
 */
6
namespace Rocket\Entities\Fields;
7
8
use Rocket\Entities\Field;
9
10
/**
11
 * An Integer field
12
 *
13
 * @property int $value The value to store
14
 */
15
class Integer extends Field
16
{
17
    /**
18
     * @var string The table associated with the model.
19
     */
20
    public $table = 'field_integer';
21
22
    /**
23
     * Checks if a field is valid
24
     *
25
     * @param mixed $value The value to validate
26
     * @return bool
27
     */
28 21
    protected function isValid($value)
29
    {
30 21
        return filter_var($value, FILTER_VALIDATE_INT) !== false;
31
    }
32
}
33