Conditions | 7 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 9.3554 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
70 | 6 | public function escape($value) |
|
71 | { |
||
72 | 6 | $value = (string) $value; |
|
73 | |||
74 | 6 | if (empty($value)) { |
|
75 | return 'false'; |
||
76 | 6 | } elseif ($value == '1') { |
|
77 | return 'true'; |
||
78 | } |
||
79 | |||
80 | 6 | if (is_numeric($value)) { |
|
81 | return (string) $value; |
||
82 | } |
||
83 | |||
84 | 6 | if (is_string($value) && ctype_alnum($value) && !is_numeric($value)) { |
|
85 | 6 | return (string) $value; |
|
86 | } |
||
87 | |||
88 | return var_export($value, true); |
||
89 | } |
||
90 | } |
||
91 |