@@ 121-130 (lines=10) @@ | ||
118 | * {@inheritDoc} |
|
119 | * @return $this |
|
120 | */ |
|
121 | public function concat($iterable) |
|
122 | { |
|
123 | if (!is_array($iterable) && !$iterable instanceof \Traversable) { |
|
124 | throw new \InvalidArgumentException('The items must be an array or Traversable'); |
|
125 | } |
|
126 | ||
127 | $this->setAll($this->concatRecurse($this, $iterable)); |
|
128 | ||
129 | return $this; |
|
130 | } |
|
131 | ||
132 | /** |
|
133 | * {@inheritDoc} |
|
@@ 136-145 (lines=10) @@ | ||
133 | * {@inheritDoc} |
|
134 | * @return $this |
|
135 | */ |
|
136 | public function replace($iterable) |
|
137 | { |
|
138 | if (!is_array($iterable) && !$iterable instanceof \Traversable) { |
|
139 | throw new \InvalidArgumentException('The items must be an array or Traversable'); |
|
140 | } |
|
141 | ||
142 | $this->setAll($this->concatRecurse($this, $iterable)); |
|
143 | ||
144 | return $this; |
|
145 | } |
|
146 | ||
147 | private function concatRecurse($array, $array1) |
|
148 | { |