Code Duplication    Length = 4-4 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 265-268 (lines=4) @@
262
            return new SS_HTTPResponse(null, 400);
263
        }
264
265
        if (!isset($data['id']) || !is_numeric($data['id'])) {
266
            return (new SS_HTTPResponse(json_encode(['status' => 'error']), 400))
267
                ->addHeader('Content-Type', 'application/json');
268
        }
269
270
        $id = $data['id'];
271
        $record = $this->getList()->filter('ID', (int) $id)->first();
@@ 314-317 (lines=4) @@
311
            return new SS_HTTPResponse(null, 400);
312
        }
313
314
        if (!isset($vars['ids']) || !$vars['ids']) {
315
            return (new SS_HTTPResponse(json_encode(['status' => 'error']), 400))
316
                ->addHeader('Content-Type', 'application/json');
317
        }
318
319
        $fileIds = $vars['ids'];
320
        $files = $this->getList()->filter("ID", $fileIds)->toArray();
@@ 683-686 (lines=4) @@
680
     */
681
    public function save($data, $form)
682
    {
683
        if (!isset($data['ID']) || !is_numeric($data['ID'])) {
684
            return (new SS_HTTPResponse(json_encode(['status' => 'error']), 400))
685
                ->addHeader('Content-Type', 'application/json');
686
        }
687
688
        $id = (int) $data['ID'];
689
        $record = $this->getList()->filter('ID', $id)->first();