Code Duplication    Length = 8-8 lines in 2 locations

core/libraries/rest_api/controllers/model/Write.php 2 locations

@@ 218-225 (lines=8) @@
215
            true
216
        );
217
        $model_obj = $model->get_one_by_ID($obj_id);
218
        if (! $model_obj instanceof EE_Base_Class) {
219
            $lowercase_model_name = strtolower($model->get_this_model_name());
220
            throw new RestException(
221
                sprintf('rest_%s_invalid_id', $lowercase_model_name),
222
                sprintf(__('Invalid %s ID.', 'event_espresso'), $lowercase_model_name),
223
                array('status' => 404)
224
            );
225
        }
226
        $model_obj->save($model_data);
227
        return $this->returnModelObjAsJsonResponse($model_obj, $request);
228
    }
@@ 261-268 (lines=8) @@
258
        $obj_id = $request->get_param('id');
259
        // this is where we would apply more fine-grained caps
260
        $model_obj = $model->get_one_by_ID($obj_id);
261
        if (! $model_obj instanceof EE_Base_Class) {
262
            $lowercase_model_name = strtolower($model->get_this_model_name());
263
            throw new RestException(
264
                sprintf('rest_%s_invalid_id', $lowercase_model_name),
265
                sprintf(__('Invalid %s ID.', 'event_espresso'), $lowercase_model_name),
266
                array('status' => 404)
267
            );
268
        }
269
        $requested_permanent_delete = filter_var($request->get_param('force'), FILTER_VALIDATE_BOOLEAN);
270
        $requested_allow_blocking = filter_var($request->get_param('allow_blocking'), FILTER_VALIDATE_BOOLEAN);
271
        if ($requested_permanent_delete) {