Code Duplication    Length = 16-16 lines in 2 locations

src/Post/Model.php 1 location

@@ 225-240 (lines=16) @@
222
     *
223
     * @return $this
224
     */
225
    public function save()
226
    {
227
        if (! $this->id) {
228
            $result = wp_insert_post($this->object->to_array(), true);
229
        } else {
230
            $result = wp_update_post($this->object, true);
231
        }
232
233
        if (is_wp_error($result)) {
234
            throw new WP_ErrorException($result);
235
        }
236
237
        $this->setId($result)->refresh();
238
239
        return $this;
240
    }
241
242
    /**
243
     * Permanently delete the post from the database.

src/User/Model.php 1 location

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