| Conditions | 6 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public static function filter(array $results, $joinArray = null) |
||
| 21 | { |
||
| 22 | if ($joinArray) { |
||
| 23 | foreach ($joinArray as $join) { |
||
| 24 | foreach ($results as $key => $result) { |
||
| 25 | $arrayToJoin = $join['array']; |
||
| 26 | $arrayName = $join['arrayName']; |
||
| 27 | $parentKey = $join['parentKey']; |
||
| 28 | $foreignKey = $join['foreignKey']; |
||
| 29 | |||
| 30 | if (array_key_exists($parentKey, $result) && $arrayToJoin[$foreignKey] === $result[$parentKey]) { |
||
| 31 | $results[$key][$arrayName] = $arrayToJoin; |
||
| 32 | } else { |
||
| 33 | unset($results[$key]); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | return $results; |
||
| 40 | } |
||
| 42 |