Code Duplication    Length = 18-19 lines in 2 locations

src/Models/Collections/AbstractCollection.php 2 locations

@@ 236-253 (lines=18) @@
233
     * @param   AbstractModel   $model  The model to push.
234
     * @return  self
235
     */
236
    public function push(AbstractModel $model)
237
    {
238
        $this->validateAdd($model);
239
        if (true === $this->willAdd($model)) {
240
            return $this;
241
        }
242
        if (true === $this->willRemove($model)) {
243
            $this->evict('removed', $model);
244
            $this->set('models', $model);
245
            return $this;
246
        }
247
        if (true === $this->hasOriginal($model)) {
248
            return $this;
249
        }
250
        $this->set('added', $model);
251
        $this->set('models', $model);
252
        return $this;
253
    }
254
255
    /**
256
     * Removes a model from the collection.
@@ 261-279 (lines=19) @@
258
     * @param   AbstractModel   $model  The model to remove.
259
     * @return  self
260
     */
261
    public function remove(AbstractModel $model)
262
    {
263
        $this->validateAdd($model);
264
        if (true === $this->willRemove($model)) {
265
            return $this;
266
        }
267
268
        if (true === $this->willAdd($model)) {
269
            $this->evict('added', $model);
270
            $this->evict('models', $model);
271
            return $this;
272
        }
273
274
        if (true === $this->hasOriginal($model)) {
275
            $this->evict('models', $model);
276
            $this->set('removed', $model);
277
        }
278
        return $this;
279
    }
280
281
    /**
282
     * {@inheritDoc}