Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/Tree.php 1 location

@@ 59-71 (lines=13) @@
56
        }
57
    }
58
59
    public function finishSave()
60
    {
61
        if (!($this->isNodesModel() && $this->isRelation())) {
62
            return;
63
        }
64
        $attribute = $this->getName();
65
        $values    = $this->getValueFromRequest();
66
67
        $relation = $this->getModel()->{$attribute}();
68
        if ($relation instanceof BelongsToMany) {
69
            $relation->sync($values);
70
        }
71
    }
72
73
    protected function isNodesModel()
74
    {

src/Form/Elements/MultiSelect.php 1 location

@@ 40-52 (lines=13) @@
37
        }
38
    }
39
40
    public function finishSave()
41
    {
42
        if (!($this->isOptionsModel() && $this->isRelation())) {
43
            return;
44
        }
45
        $attribute = $this->getName();
46
        $values = $this->getValueFromRequest();
47
48
        $relation = $this->getModel()->{$attribute}();
49
        if ($relation instanceof BelongsToMany) {
50
            $relation->sync($values);
51
        }
52
    }
53
54
    protected function isOptionsModel()
55
    {