Code Duplication    Length = 4-4 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 277-280 (lines=4) @@
274
            return new HTTPResponse(null, 400);
275
        }
276
277
        if (!isset($vars['ids']) || !$vars['ids']) {
278
            return (new HTTPResponse(json_encode(['status' => 'error']), 400))
279
                ->addHeader('Content-Type', 'application/json');
280
        }
281
282
        $fileIds = $vars['ids'];
283
        $files = $this->getList()->filter("ID", $fileIds)->toArray();
@@ 658-661 (lines=4) @@
655
     * @return HTTPResponse
656
     */
657
    protected function saveOrPublish($data, $form, $doPublish = false) {
658
        if (!isset($data['ID']) || !is_numeric($data['ID'])) {
659
            return (new HTTPResponse(json_encode(['status' => 'error']), 400))
660
                ->addHeader('Content-Type', 'application/json');
661
        }
662
663
        $id = (int) $data['ID'];
664
        /** @var File $record */
@@ 695-698 (lines=4) @@
692
    }
693
694
    public function unpublish($data, $form) {
695
        if (!isset($data['ID']) || !is_numeric($data['ID'])) {
696
            return (new HTTPResponse(json_encode(['status' => 'error']), 400))
697
                ->addHeader('Content-Type', 'application/json');
698
        }
699
700
        $id = (int) $data['ID'];
701
        /** @var File $record */