| @@ 33-46 (lines=14) @@ | ||
| 30 | ||
| 31 | $extraIndexed = []; |
|
| 32 | ||
| 33 | foreach ($instruction->extra as $extra) { |
|
| 34 | $key = \Jasny\DotKey::on($extra)->get($match['extra']); |
|
| 35 | ||
| 36 | if (!isset($key) || isset($extraIndexed[$key])) { |
|
| 37 | continue; |
|
| 38 | } |
|
| 39 | ||
| 40 | if (!is_scalar($key)) { |
|
| 41 | trigger_error("Trying to match on non-scalar type", E_WARNING); |
|
| 42 | continue; |
|
| 43 | } |
|
| 44 | ||
| 45 | $extraIndexed[$key] = $extra; |
|
| 46 | } |
|
| 47 | ||
| 48 | foreach ($source as &$item) { |
|
| 49 | $key = \Jasny\DotKey::on($item)->get($match['source']); |
|
| @@ 48-61 (lines=14) @@ | ||
| 45 | $extraIndexed[$key] = $extra; |
|
| 46 | } |
|
| 47 | ||
| 48 | foreach ($source as &$item) { |
|
| 49 | $key = \Jasny\DotKey::on($item)->get($match['source']); |
|
| 50 | ||
| 51 | if (!isset($key) || !isset($extraIndexed[$key])) { |
|
| 52 | continue; |
|
| 53 | } |
|
| 54 | ||
| 55 | if (!is_scalar($key)) { |
|
| 56 | trigger_error("Trying to match on non-scalar type", E_WARNING); |
|
| 57 | continue; |
|
| 58 | } |
|
| 59 | ||
| 60 | $item = array_merge((array)$item, (array)$extraIndexed[$key]); |
|
| 61 | } |
|
| 62 | ||
| 63 | $node->setResult($source); |
|
| 64 | } |
|