Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
11 | 12 | public static function toBoolean(string $value, bool $default) : bool |
|
12 | { |
||
13 | 12 | switch (strtolower($value)) { |
|
14 | 12 | case 'true': |
|
15 | 12 | return true; |
|
16 | |||
17 | 1 | case '1': |
|
18 | 1 | return true; |
|
19 | |||
20 | 1 | case 'false': |
|
21 | 1 | return false; |
|
22 | |||
23 | 1 | case '0': |
|
24 | 1 | return false; |
|
25 | |||
26 | default: |
||
27 | 1 | return $default; |
|
28 | } |
||
31 |