| Conditions | 6 |
| Paths | 18 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public static function isElementValid($element, $array) |
||
| 21 | { |
||
| 22 | foreach ($array as $key => $item) { |
||
| 23 | if (is_object($item)) { |
||
| 24 | $array[$key] = ArrayHelper::convertToPlainArray($item); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | if (is_object($element)) { |
||
| 29 | $element = ArrayHelper::convertToPlainArray($element); |
||
| 30 | } |
||
| 31 | |||
| 32 | $firstItem = current($array); |
||
| 33 | |||
| 34 | if (false === ArrayHelper::checkIfTwoArraysAreConsistent(array_keys($firstItem), array_keys($element))) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | if(false === ArrayHelper::compareElementToItemKeyMap($firstItem, $element)) { |
||
| 39 | return false; |
||
| 40 | } |
||
| 41 | |||
| 42 | return true; |
||
| 43 | } |
||
| 60 |