Completed
Push — master ( 0c75f6...35d3bb )
by Stéphane
14:38
created

Boolean::isValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
1
<?php namespace Rocket\Entities\Fields;
2
3
use Rocket\Entities\Field;
4
5
class Boolean extends Field
6
{
7
    public $table = 'field_boolean';
8
9
    /**
10
     * {@inheritdoc}
11
     */
12
    protected $casts = [
13
        'value' => 'boolean',
14
    ];
15
16
    /**
17
     * {@inheritdoc}
18
     */
19 27
    protected function isValid($value)
20
    {
21 27
        $acceptable = [true, false, 0, 1, '0', '1'];
22
23 27
        return in_array($value, $acceptable, true);
24
    }
25
}
26