| @@ 253-272 (lines=20) @@ | ||
| 250 | return $initial; |
|
| 251 | } |
|
| 252 | ||
| 253 | private function concatRecurse($array, $array1) |
|
| 254 | { |
|
| 255 | $merged = $array; |
|
| 256 | ||
| 257 | foreach ($array1 as $key => $value) { |
|
| 258 | $isValid = function ($value) { |
|
| 259 | return (is_array($value) || $value instanceof \Traversable); |
|
| 260 | }; |
|
| 261 | ||
| 262 | if (($isValid($value) && isset($merged[$key])) && $isValid($merged[$key])) { |
|
| 263 | $merged[$key] = $this->concatRecurse($merged[$key], $value); |
|
| 264 | } else { |
|
| 265 | if (!in_array($value, $merged->toArray())) { |
|
| 266 | $merged[] = $value; |
|
| 267 | } |
|
| 268 | } |
|
| 269 | } |
|
| 270 | ||
| 271 | return $merged; |
|
| 272 | } |
|
| 273 | } |
|
| 274 | ||
| @@ 238-255 (lines=18) @@ | ||
| 235 | return $results; |
|
| 236 | } |
|
| 237 | ||
| 238 | private function concatRecurse($array, $array1) |
|
| 239 | { |
|
| 240 | $merged = $array; |
|
| 241 | ||
| 242 | foreach ($array1 as $key => $value) { |
|
| 243 | $isValid = function ($value) { |
|
| 244 | return (is_array($value) || $value instanceof \Traversable); |
|
| 245 | }; |
|
| 246 | ||
| 247 | if (($isValid($value) && isset($merged[$key])) && $isValid($merged[$key])) { |
|
| 248 | $merged[$key] = $this->concatRecurse($merged[$key], $value); |
|
| 249 | } else { |
|
| 250 | $merged[$key] = $value; |
|
| 251 | } |
|
| 252 | } |
|
| 253 | ||
| 254 | return $merged; |
|
| 255 | } |
|
| 256 | } |
|
| 257 | ||