@@ 531-542 (lines=12) @@ | ||
528 | * |
|
529 | * @return Collection |
|
530 | */ |
|
531 | public function merge($items, $inPlace = false) |
|
532 | { |
|
533 | if (!is_array($items) && !($items instanceof Traversable)) { |
|
534 | $this->doThrow('Invalid input type for '.($inPlace ? 'coalesce' : 'merge').'.', $items); |
|
535 | } |
|
536 | $collection = $inPlace ? $this : clone $this; |
|
537 | foreach ($items as $key => $value) { |
|
538 | $collection->set($key, $value); |
|
539 | } |
|
540 | ||
541 | return $collection; |
|
542 | } |
|
543 | ||
544 | /** |
|
545 | * Merge (in-place). |
|
@@ 566-579 (lines=14) @@ | ||
563 | * |
|
564 | * @return Collection |
|
565 | */ |
|
566 | public function union($items, $inPlace = false) |
|
567 | { |
|
568 | if (!is_array($items) && !($items instanceof Traversable)) { |
|
569 | $this->doThrow('Invalid input type for '.($inPlace ? 'absorb' : 'union'), $items); |
|
570 | } |
|
571 | $collection = $inPlace ? $this : clone $this; |
|
572 | foreach ($items as $key => $value) { |
|
573 | if (!$collection->containsKey($key)) { |
|
574 | $collection->set($key, $value); |
|
575 | } |
|
576 | } |
|
577 | ||
578 | return $collection; |
|
579 | } |
|
580 | ||
581 | /** |
|
582 | * Union (in-place). |
@@ 179-190 (lines=12) @@ | ||
176 | /** |
|
177 | * {@inheritdoc} |
|
178 | */ |
|
179 | public function merge($items, $inPlace = false) |
|
180 | { |
|
181 | if (!is_array($items) && !($items instanceof Traversable)) { |
|
182 | $this->doThrow('Invalid input type for '.__METHOD__.', cannot merge.', $items); |
|
183 | } |
|
184 | $collection = $inPlace ? $this : clone $this; |
|
185 | foreach ($items as $key => $value) { |
|
186 | $collection->set($key, $value); |
|
187 | } |
|
188 | ||
189 | return $collection; |
|
190 | } |
|
191 | ||
192 | /** |
|
193 | * {@inheritdoc} |
|
@@ 195-208 (lines=14) @@ | ||
192 | /** |
|
193 | * {@inheritdoc} |
|
194 | */ |
|
195 | public function union($items, $inPlace = false) |
|
196 | { |
|
197 | if (!is_array($items) && !($items instanceof Traversable)) { |
|
198 | $this->doThrow('Invalid input type for '.__METHOD__.', cannot union.', $items); |
|
199 | } |
|
200 | $collection = $inPlace ? $this : clone $this; |
|
201 | foreach ($items as $key => $value) { |
|
202 | if (!$collection->containsKey($key)) { |
|
203 | $collection->set($key, $value); |
|
204 | } |
|
205 | } |
|
206 | ||
207 | return $collection; |
|
208 | } |
|
209 | ||
210 | /** |
|
211 | * {@inheritdoc} |