Code Duplication    Length = 13-14 lines in 2 locations

src/Models/Model.php 2 locations

@@ 382-395 (lines=14) @@
379
     * @param   Model   $model  The model to remove from the collection.
380
     * @return  self
381
     */
382
    public function remove($key, Model $model)
383
    {
384
        if (false === $this->isHasMany($key)) {
385
            return $this;
386
        }
387
        if (true === $this->isInverse($key)) {
388
            throw ModelException::cannotModifyInverse($this, $key);
389
        }
390
        $this->touch();
391
        $collection = $this->hasManyRelationships->get($key);
392
        $collection->remove($model);
393
        $this->doDirtyCheck();
394
        return $this;
395
    }
396
397
    /**
398
     * {@inheritdoc}
@@ 507-519 (lines=13) @@
504
     * @param   Model|null  $model  The model to relate.
505
     * @return  self
506
     */
507
    protected function setHasOne($key, Model $model = null)
508
    {
509
        if (true === $this->isInverse($key)) {
510
            throw ModelException::cannotModifyInverse($this, $key);
511
        }
512
        if (null !== $model) {
513
            $this->validateRelSet($key, $model->getType());
514
        }
515
        $this->touch();
516
        $this->hasOneRelationships->set($key, $model);
517
        $this->doDirtyCheck();
518
        return $this;
519
    }
520
521
    /**
522
     * Sets a relationship value.