Code Duplication    Length = 8-8 lines in 4 locations

src/ArrayImitator.php 4 locations

@@ 138-145 (lines=8) @@
135
     * @return static A new array with the keys/values
136
     * from $array added, that weren't present in the original
137
     */
138
    public function mergeTo(array $array, $recursively = false)
139
    {
140
        if (true === $recursively) {
141
            return new static(array_merge_recursive($array, $this->elements));
142
        }
143
144
        return new static(array_merge($array, $this->elements));
145
    }
146
147
    /**
148
     * Merges this array with the provided one. Latter array is overwriting.
@@ 155-162 (lines=8) @@
152
     *
153
     * @return static A new array with the keys/values from $array added
154
     */
155
    public function mergeWith(array $array, $recursively = false)
156
    {
157
        if (true === $recursively) {
158
            return new static(array_merge_recursive($this->elements, $array));
159
        }
160
161
        return new static(array_merge($this->elements, $array));
162
    }
163
164
    /**
165
     * Pad array to the specified size with a given value.
@@ 197-204 (lines=8) @@
194
     *
195
     * @return static A new array with keys from $array and values from both.
196
     */
197
    public function replaceIn(array $array, $recursively = false)
198
    {
199
        if (true === $recursively) {
200
            return new static(array_replace_recursive($array, $this->elements));
201
        }
202
203
        return new static(array_replace($array, $this->elements));
204
    }
205
206
    /**
207
     * Replace values in this array with values in the other array
@@ 215-222 (lines=8) @@
212
     *
213
     * @return static A new array with the same keys but new values
214
     */
215
    public function replaceWith(array $array, $recursively = false)
216
    {
217
        if (true === $recursively) {
218
            return new static(array_replace_recursive($this->elements, $array));
219
        }
220
221
        return new static(array_replace($this->elements, $array));
222
    }
223
224
    /**
225
     * Reverse the order of the array values.