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

@@ 144-158 (lines=15) @@
141
     *
142
     * @return  array
143
     */
144
    public function calculateChangeSet()
145
    {
146
        $set = [];
147
        foreach ($this->current as $key => $current) {
148
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
149
            $set[$key]['old'] = $original;
150
            $set[$key]['new'] = $current;
151
        }
152
        foreach ($this->remove as $key) {
153
            $set[$key]['old'] = $this->original[$key];
154
            $set[$key]['new'] = null;
155
        }
156
        ksort($set);
157
        return $set;
158
    }
159
160
    /**
161
     * Clears an property from the removal queue.