Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/MultiSelect.php 1 location

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

src/Form/Elements/Tree.php 1 location

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