Conditions | 3 |
Paths | 4 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
52 | 1 | protected static function range($query, $attribute, $start = null, $end = null) |
|
53 | { |
||
54 | 1 | if (!empty($start)) { |
|
55 | 1 | $query = $query->andWhere(['>=', $attribute, $start]); |
|
56 | 1 | } |
|
57 | 1 | if (!empty($end)) { |
|
58 | 1 | $query = $query->andWhere(['<', $attribute, $end]); |
|
59 | 1 | } |
|
60 | 1 | return $query; |
|
61 | } |
||
62 | } |
||
63 |
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: