Conditions | 7 |
Paths | 17 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
14 | 499 | public static function isValid(array $data) |
|
15 | { |
||
16 | 499 | $index = array(); |
|
17 | 499 | foreach ($data as $value) { |
|
18 | 481 | if (is_array($value) || $value instanceof \stdClass) { |
|
19 | 43 | $value = json_encode($value); |
|
20 | } |
||
21 | 481 | if (is_bool($value)) { |
|
22 | 33 | $value = '_______BOOL' . $value; |
|
23 | } |
||
24 | 481 | if ($value instanceof ObjectItemContract) { |
|
25 | 1 | $value = json_encode($value); |
|
26 | } |
||
27 | 481 | $tmp = &$index[$value]; |
|
28 | 481 | if ($tmp !== null) { |
|
29 | 19 | return false; |
|
30 | } |
||
31 | 481 | $tmp = true; |
|
32 | } |
||
33 | 480 | return true; |
|
34 | } |
||
36 | } |