/** * @param Data|Reference $item * @param array $target * @return array */ private static function merge($item, $target) { if ($item instanceof Reference) { $target = $item; } else { $value = $item->getValue(); if (is_array($value)) { $target = array_merge($target, $value); } else { $target[] = $value; } } return $target; }