Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
35 | 108 | public function __invoke($subject, string $field): bool |
|
36 | { |
||
37 | 108 | $value = $subject->$field; |
|
38 | |||
39 | 108 | if ($this->isTrue($value)) { |
|
40 | 54 | $subject->$field = $this->trueValue; |
|
41 | |||
42 | 54 | return true; |
|
43 | } |
||
44 | |||
45 | 54 | if ($this->isFalse($value)) { |
|
46 | 48 | $subject->$field = $this->falseValue; |
|
47 | |||
48 | 48 | return true; |
|
49 | } |
||
50 | |||
51 | 6 | $subject->$field = $value ? $this->trueValue : $this->falseValue; |
|
52 | |||
53 | 6 | return true; |
|
54 | } |
||
56 |