Code Duplication    Length = 5-8 lines in 3 locations

src/Models/Embeds/HasOne.php 2 locations

@@ 59-66 (lines=8) @@
56
    public function calculateChangeSet()
57
    {
58
        $set = [];
59
        foreach ($this->original as $key => $current) {
60
            if (false === $current->isDirty()) {
61
                continue;
62
            }
63
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
64
            $set[$key]['old'] = $original;
65
            $set[$key]['new'] = $current;
66
        }
67
68
        foreach ($this->current as $key => $current) {
69
            if (false === $current->isDirty()) {
@@ 68-75 (lines=8) @@
65
            $set[$key]['new'] = $current;
66
        }
67
68
        foreach ($this->current as $key => $current) {
69
            if (false === $current->isDirty()) {
70
                continue;
71
            }
72
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
73
            $set[$key]['old'] = $original;
74
            $set[$key]['new'] = $current;
75
        }
76
77
        foreach ($this->remove as $key) {
78
            $set[$key]['old'] = $this->original[$key];

src/Models/Properties.php 1 location

@@ 152-156 (lines=5) @@
149
    public function calculateChangeSet()
150
    {
151
        $set = [];
152
        foreach ($this->current as $key => $current) {
153
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
154
            $set[$key]['old'] = $original;
155
            $set[$key]['new'] = $current;
156
        }
157
        foreach ($this->remove as $key) {
158
            $set[$key]['old'] = $this->original[$key];
159
            $set[$key]['new'] = null;