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

@@ 48-60 (lines=13) @@
45
        }
46
    }
47
48
    public function finishSave()
49
    {
50
        if (!($this->isOptionsModel() && $this->isRelation())) {
51
            return;
52
        }
53
        $attribute = $this->getName();
54
        $values = $this->getValueFromRequest();
55
56
        $relation = $this->getModel()->{$attribute}();
57
        if ($relation instanceof BelongsToMany) {
58
            $relation->sync($values);
59
        }
60
    }
61
62
    protected function parseOptions($options)
63
    {