Code Duplication    Length = 16-24 lines in 3 locations

src/Collection/AbstractCollection.php 3 locations

@@ 154-169 (lines=16) @@
151
     * @return static
152
     *                <p>(Mutable) Return this Arrayy object, with the prepended value.</p>
153
     */
154
    public function prepend($value, $key = null): Arrayy
155
    {
156
        if (
157
            $value instanceof self
158
            &&
159
            !$value instanceof TypeInterface
160
        ) {
161
            foreach ($value as $valueTmp) {
162
                parent::prepend($valueTmp, $key);
163
            }
164
165
            return $this;
166
        }
167
168
        return parent::prepend($value, $key);
169
    }
170
171
    /**
172
     * Append a (key) + value to the current array.
@@ 180-195 (lines=16) @@
177
     * @return static
178
     *                <p>(Mutable) Return this Arrayy object, with the appended values.</p>
179
     */
180
    public function append($value, $key = null): Arrayy
181
    {
182
        if (
183
            $value instanceof self
184
            &&
185
            !$value instanceof TypeInterface
186
        ) {
187
            foreach ($value as $valueTmp) {
188
                parent::append($valueTmp, $key);
189
            }
190
191
            return $this;
192
        }
193
194
        return parent::append($value, $key);
195
    }
196
197
    /**
198
     * Returns the values from given property or method.
@@ 251-274 (lines=24) @@
248
     *
249
     * @return bool
250
     */
251
    protected function internalSet($key, &$value, $checkPropertiesAndType = true): bool
252
    {
253
        if (
254
            $value instanceof self
255
            &&
256
            !$value instanceof TypeInterface
257
        ) {
258
            foreach ($value as $valueTmp) {
259
                parent::internalSet(
260
                    $key,
261
                    $valueTmp,
262
                    $checkPropertiesAndType
263
                );
264
            }
265
266
            return true;
267
        }
268
269
        return parent::internalSet(
270
            $key,
271
            $value,
272
            $checkPropertiesAndType
273
        );
274
    }
275
276
    /**
277
     * @param mixed $type