Code Duplication    Length = 15-19 lines in 2 locations

src/Models/Embeds/HasOne.php 1 location

@@ 51-69 (lines=19) @@
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function calculateChangeSet()
52
    {
53
        $set = [];
54
        foreach ($this->current as $key => $current) {
55
            if (false === $current->isDirty()) {
56
                continue;
57
            }
58
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
59
            $set[$key]['old'] = $original;
60
            $set[$key]['new'] = $current;
61
        }
62
63
        foreach ($this->remove as $key) {
64
            $set[$key]['old'] = $this->original[$key];
65
            $set[$key]['new'] = null;
66
        }
67
        ksort($set);
68
        return $set;
69
    }
70
71
    /**
72
     * {@inheritdoc}

src/Models/Properties.php 1 location

@@ 149-163 (lines=15) @@
146
     *
147
     * @return  array
148
     */
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;
160
        }
161
        ksort($set);
162
        return $set;
163
    }
164
165
    /**
166
     * Clears an property from the removal queue.