Code Duplication    Length = 4-4 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 332-335 (lines=4) @@
329
        // check canAddChildren permissions
330
        if (!empty($data['ParentID']) && is_numeric($data['ParentID'])) {
331
            $parentRecord = Folder::get()->byID($data['ParentID']);
332
            if ($parentRecord->hasMethod('canAddChildren') && !$parentRecord->canAddChildren()) {
333
                return (new SS_HTTPResponse(json_encode(['status' => 'error']), 403))
334
                    ->addHeader('Content-Type', 'application/json');
335
            }
336
        } else {
337
            $parentRecord = singleton('Folder');
338
        }
@@ 387-390 (lines=4) @@
384
        // check addchildren permissions
385
        if (!empty($data['ParentID']) && is_numeric($data['ParentID'])) {
386
            $parentRecord = \DataObject::get_by_id($class, $data['ParentID']);
387
            if ($parentRecord->hasMethod('canAddChildren') && !$parentRecord->canAddChildren()) {
388
                return (new SS_HTTPResponse(null, 403))
389
                    ->addHeader('Content-Type', 'application/json');
390
            }
391
        } else {
392
            $parentRecord = singleton($class);
393
        }