Total Complexity | 7 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | class Boolean |
||
20 | { |
||
21 | /** |
||
22 | * Determines if the value is `true`, otherwise it will return `false`. |
||
23 | * |
||
24 | * @param mixed $value |
||
25 | * |
||
26 | * @return bool |
||
27 | */ |
||
28 | 2 | public function isTrue($value): bool |
|
29 | { |
||
30 | 2 | return $this->to($value) === true; |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * Determines if the value is `false`, otherwise it will return `true`. |
||
35 | * |
||
36 | * @param mixed $value |
||
37 | * |
||
38 | * @return bool |
||
39 | */ |
||
40 | 2 | public function isFalse($value): bool |
|
41 | { |
||
42 | 2 | return $this->to($value) === false; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * Converts a value to a boolean type. |
||
47 | * |
||
48 | * @param mixed $value |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | 6 | public function to($value): bool |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * Getting a filtered value in a boolean view. |
||
59 | * |
||
60 | * @param mixed $value |
||
61 | * |
||
62 | * @return bool|null |
||
63 | */ |
||
64 | 10 | public function parse($value): ?bool |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * Converts a boolean value to a string. |
||
75 | * |
||
76 | * @param bool $value |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 2 | public function convertToString(bool $value): string |
|
85 |