Code Duplication    Length = 13-14 lines in 2 locations

src/Models/Model.php 2 locations

@@ 397-410 (lines=14) @@
394
     * @param   Model   $model  The model to remove from the collection.
395
     * @return  self
396
     */
397
    public function remove($key, Model $model)
398
    {
399
        if (false === $this->isHasMany($key)) {
400
            return $this;
401
        }
402
        if (true === $this->isInverse($key)) {
403
            throw ModelException::cannotModifyInverse($this, $key);
404
        }
405
        $this->touch();
406
        $collection = $this->hasManyRelationships->get($key);
407
        $collection->remove($model);
408
        $this->doDirtyCheck();
409
        return $this;
410
    }
411
412
    /**
413
     * {@inheritdoc}
@@ 522-534 (lines=13) @@
519
     * @param   Model|null  $model  The model to relate.
520
     * @return  self
521
     */
522
    protected function setHasOne($key, Model $model = null)
523
    {
524
        if (true === $this->isInverse($key)) {
525
            throw ModelException::cannotModifyInverse($this, $key);
526
        }
527
        if (null !== $model) {
528
            $this->validateRelSet($key, $model->getType());
529
        }
530
        $this->touch();
531
        $this->hasOneRelationships->set($key, $model);
532
        $this->doDirtyCheck();
533
        return $this;
534
    }
535
536
    /**
537
     * Sets a relationship value.