Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
19 | 12 | public static function toBoolean(string $value, bool $default) : bool |
|
20 | { |
||
21 | 12 | switch (strtolower($value)) { |
|
22 | 12 | case 'true': |
|
23 | 12 | return true; |
|
24 | |||
25 | 1 | case '1': |
|
26 | 1 | return true; |
|
27 | |||
28 | 1 | case 'false': |
|
29 | 1 | return false; |
|
30 | |||
31 | 1 | case '0': |
|
32 | 1 | return false; |
|
33 | |||
34 | default: |
||
35 | 1 | return $default; |
|
36 | } |
||
39 |