Conditions | 3 |
Paths | 3 |
Total Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
32 | 4 | public function validate(string $access = null, string $groups = null) : bool |
|
33 | { |
||
34 | 4 | $accessArray = (array)json_decode($access); |
|
35 | 4 | $groupArray = (array)json_decode($groups); |
|
36 | 4 | return !$access || in_array(1, $groupArray) || array_intersect($accessArray, $groupArray); |
|
|
|||
37 | } |
||
38 | } |
||
39 |
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: