Code Duplication    Length = 8-8 lines in 2 locations

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

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