Code Duplication    Length = 14-14 lines in 2 locations

src/RemServer/RemServerController.php 2 locations

@@ 103-116 (lines=14) @@
100
     *
101
     * @return array
102
     */
103
    public function postItem(string $dataset) : array
104
    {
105
        try {
106
            $entry = $this->di->get("request")->getBodyAsJson();
107
        } catch (\Anax\Request\Exception $e) {
108
            return [
109
                ["message" => "500. HTTP request body is not an object/array or valid JSON."],
110
                500
111
            ];
112
        }
113
114
        $item = $this->di->get("remserver")->addItem($dataset, $entry);
115
        return [$item];
116
    }
117
118
119
@@ 128-141 (lines=14) @@
125
     *
126
     * @return void
127
     */
128
    public function putItem(string $dataset, int $itemId) : array
129
    {
130
        try {
131
            $entry = $this->di->get("request")->getBodyAsJson();
132
        } catch (\Anax\Request\Exception $e) {
133
            return [
134
                ["message" => "500. HTTP request body is not an object/array or valid JSON."],
135
                500
136
            ];
137
        }
138
        
139
        $item = $this->di->get("remserver")->upsertItem($dataset, $itemId, $entry);
140
        return [$item];
141
    }
142
143
144