Code Duplication    Length = 15-15 lines in 3 locations

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

@@ 107-121 (lines=15) @@
104
     * @param string          $model_name
105
     * @return WP_REST_Response|\WP_Error
106
     */
107
    public static function handleRequestDelete(WP_REST_Request $request, $version, $model_name)
108
    {
109
        $controller = new Write();
110
        try {
111
            $controller->setRequestedVersion($version);
112
            return $controller->sendResponse(
113
                $controller->delete(
114
                    $controller->getModelVersionInfo()->loadModel($model_name),
115
                    $request
116
                )
117
            );
118
        } catch (Exception $e) {
119
            return $controller->sendResponse($e);
120
        }
121
    }
122
123
124
    /**
@@ 57-71 (lines=15) @@
54
     * @param string          $model_name
55
     * @return WP_REST_Response|\WP_Error
56
     */
57
    public static function handleRequestInsert(WP_REST_Request $request, $version, $model_name)
58
    {
59
        $controller = new Write();
60
        try {
61
            $controller->setRequestedVersion($version);
62
            return $controller->sendResponse(
63
                $controller->insert(
64
                    $controller->getModelVersionInfo()->loadModel($model_name),
65
                    $request
66
                )
67
            );
68
        } catch (Exception $e) {
69
            return $controller->sendResponse($e);
70
        }
71
    }
72
73
74
    /**
@@ 82-96 (lines=15) @@
79
     * @param string          $model_name
80
     * @return WP_REST_Response|\WP_Error
81
     */
82
    public static function handleRequestUpdate(WP_REST_Request $request, $version, $model_name)
83
    {
84
        $controller = new Write();
85
        try {
86
            $controller->setRequestedVersion($version);
87
            return $controller->sendResponse(
88
                $controller->update(
89
                    $controller->getModelVersionInfo()->loadModel($model_name),
90
                    $request
91
                )
92
            );
93
        } catch (Exception $e) {
94
            return $controller->sendResponse($e);
95
        }
96
    }
97
98
99
    /**