Code Duplication    Length = 4-4 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 362-365 (lines=4) @@
359
        // check canAddChildren permissions
360
        if (!empty($data['ParentID']) && is_numeric($data['ParentID'])) {
361
            $parentRecord = Folder::get()->byID($data['ParentID']);
362
            if ($parentRecord->hasMethod('canAddChildren') && !$parentRecord->canAddChildren()) {
363
                return (new SS_HTTPResponse(json_encode(['status' => 'error']), 403))
364
                    ->addHeader('Content-Type', 'application/json');
365
            }
366
        } else {
367
            $parentRecord = singleton('Folder');
368
        }
@@ 423-426 (lines=4) @@
420
        // check addchildren permissions
421
        if (!empty($data['ParentID']) && is_numeric($data['ParentID'])) {
422
            $parentRecord = DataObject::get_by_id($class, $data['ParentID']);
423
            if ($parentRecord->hasMethod('canAddChildren') && !$parentRecord->canAddChildren()) {
424
                return (new SS_HTTPResponse(null, 403))
425
                    ->addHeader('Content-Type', 'application/json');
426
            }
427
        } else {
428
            $parentRecord = singleton($class);
429
        }