| Conditions | 9 |
| Paths | 11 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | private function applyOrder(array $data, array $array): array |
||
| 33 | { |
||
| 34 | $result = []; |
||
| 35 | |||
| 36 | foreach ($array as $key => $value) { |
||
| 37 | if (is_string($key)) { |
||
| 38 | if (array_key_exists($key, $data)) { |
||
| 39 | $result[$key] = ArrayHelper::remove($data, $key); |
||
| 40 | } |
||
| 41 | } else { |
||
| 42 | foreach ($data as $dataKey => $dataValue) { |
||
| 43 | if (is_int($dataKey) && $dataValue === $value) { |
||
| 44 | $result[] = $dataValue; |
||
| 45 | unset($data[$dataKey]); |
||
| 46 | break; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | if (is_array($value) && is_array($result[$key])) { |
||
| 52 | $result[$key] = $this->applyOrder($result[$key], $value); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | return array_merge($result, $data); |
||
| 57 | } |
||
| 59 |