Conditions | 6 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 6.2163 |
Changes | 0 |
1 | <?php |
||
37 | function free($value) |
||
38 | { |
||
39 | 1 | if (is_null($value)) { |
|
40 | 1 | return true; |
|
41 | } |
||
42 | |||
43 | 1 | if (is_string($value)) { |
|
44 | 1 | return trim($value) === ''; |
|
45 | } |
||
46 | |||
47 | 1 | if (is_numeric($value)) { |
|
48 | return false; |
||
49 | } |
||
50 | |||
51 | 1 | if (is_bool($value)) { |
|
52 | 1 | return true; |
|
53 | } |
||
54 | |||
55 | 1 | if ($value instanceof Countable) { |
|
56 | return count($value) === 0; |
||
57 | } |
||
58 | |||
59 | 1 | return empty($value); |
|
60 | } |
||
61 |