Code Duplication    Length = 4-4 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 325-328 (lines=4) @@
322
        // check canAddChildren permissions
323
        if (!empty($data['ParentID']) && is_numeric($data['ParentID'])) {
324
            $parentRecord = Folder::get()->byID($data['ParentID']);
325
            if ($parentRecord->hasMethod('canAddChildren') && !$parentRecord->canAddChildren()) {
326
                return (new SS_HTTPResponse(json_encode(['status' => 'error']), 403))
327
                    ->addHeader('Content-Type', 'application/json');
328
            }
329
        } else {
330
            $parentRecord = singleton('Folder');
331
        }
@@ 386-389 (lines=4) @@
383
        // check addchildren permissions
384
        if (!empty($data['ParentID']) && is_numeric($data['ParentID'])) {
385
            $parentRecord = DataObject::get_by_id($class, $data['ParentID']);
386
            if ($parentRecord->hasMethod('canAddChildren') && !$parentRecord->canAddChildren()) {
387
                return (new SS_HTTPResponse(null, 403))
388
                    ->addHeader('Content-Type', 'application/json');
389
            }
390
        } else {
391
            $parentRecord = singleton($class);
392
        }