Code Duplication    Length = 18-19 lines in 2 locations

src/Models/Collections/AbstractCollection.php 2 locations

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