Code Duplication    Length = 16-16 lines in 2 locations

src/User/Model.php 1 location

@@ 150-165 (lines=16) @@
147
     *
148
     * @return $this
149
     */
150
    public function save()
151
    {
152
        if (! $this->id) {
153
            $result = wp_insert_user($this->object);
154
        } else {
155
            $result = wp_update_user($this->object);
156
        }
157
158
        if (is_wp_error($result)) {
159
            throw new WP_ErrorException($result);
160
        }
161
162
        $this->setId($result)->refresh();
163
164
        return $this;
165
    }
166
167
    /**
168
     * Delete the modeled record from the database.

src/Post/Model.php 1 location

@@ 212-227 (lines=16) @@
209
     *
210
     * @return $this
211
     */
212
    public function save()
213
    {
214
        if (! $this->id) {
215
            $result = wp_insert_post($this->object->to_array(), true);
216
        } else {
217
            $result = wp_update_post($this->object, true);
218
        }
219
220
        if (is_wp_error($result)) {
221
            throw new WP_ErrorException($result);
222
        }
223
224
        $this->setId($result)->refresh();
225
226
        return $this;
227
    }
228
229
    /**
230
     * Permanently delete the post from the database.