Conditions | 4 |
Paths | 5 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | protected function normalize( array $options, $key, $fallback ) |
||
36 | { |
||
37 | if( !array_key_exists( $key, $options )) { |
||
38 | return $fallback; |
||
39 | } |
||
40 | $option = $options[$key]; |
||
41 | $option = is_array( $option ) |
||
42 | ? array_filter( $option ) |
||
43 | : trim( $option ); |
||
44 | return empty( $option ) |
||
45 | ? $fallback |
||
46 | : $option; |
||
47 | } |
||
48 | } |
||
49 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: