Code Duplication    Length = 16-16 lines in 2 locations

src/Post/Model.php 1 location

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

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.