Boolean   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 27
ccs 3
cts 3
cp 1
rs 10
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 6 1
1
<?php
2
3
/**
4
 * A Boolean field
5
 */
6
namespace Rocket\Entities\Fields;
7
8
use Rocket\Entities\Field;
9
10
/**
11
 * A Boolean field
12
 *
13
 * @property bool $value The value to store
14
 */
15
class Boolean extends Field
16
{
17
    /**
18
     * @var string The table associated with the model.
19
     */
20
    public $table = 'field_boolean';
21
22
    /**
23
     * @var array The attributes that should be cast to native types.
24
     */
25
    protected $casts = [
26
        'value' => 'boolean',
27
    ];
28
29
    /**
30
     * Checks if a field is valid
31
     *
32
     * @param mixed $value The value to validate
33
     * @return bool
34
     */
35 27
    protected function isValid($value)
36
    {
37 27
        $acceptable = [true, false, 0, 1, '0', '1'];
38
39 27
        return in_array($value, $acceptable, true);
40
    }
41
}
42