Boolean   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 10
c 3
b 0
f 0
dl 0
loc 54
ccs 0
cts 12
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A onIndex() 0 3 1
A isTrue() 0 3 1
A onView() 0 3 1
A trueValue() 0 5 1
A falseValue() 0 5 1
1
<?php
2
3
namespace Terranet\Administrator\Field;
4
5
class Boolean extends Field
6
{
7
    /** @var mixed */
8
    protected $trueValue = true;
9
10
    /** @var mixed */
11
    protected $falseValue = false;
12
13
    /**
14
     * @param $value
15
     *
16
     * @return $this
17
     */
18
    public function trueValue($value)
19
    {
20
        $this->trueValue = $value;
21
22
        return $this;
23
    }
24
25
    /**
26
     * @param $value
27
     *
28
     * @return $this
29
     */
30
    public function falseValue($value)
31
    {
32
        $this->falseValue = $value;
33
34
        return $this;
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function isTrue()
41
    {
42
        return $this->value() === $this->trueValue;
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    public function onIndex()
49
    {
50
        return ['isTrue' => $this->isTrue()];
51
    }
52
53
    /**
54
     * @return array
55
     */
56
    public function onView()
57
    {
58
        return $this->onIndex();
59
    }
60
}
61