Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 425-435 (lines=11) @@
422
        $file = Injector::inst()->create($fileClass);
423
424
        // check canCreate permissions
425
        if (!$file->canCreate(null, $data)) {
426
            $result = ['message' => [
427
                'type' => 'error',
428
                'value' => _t(
429
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
430
                    'You do not have permission to add files'
431
                )
432
            ]];
433
            return (new HTTPResponse(json_encode($result), 403))
434
                ->addHeader('Content-Type', 'application/json');
435
        }
436
437
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
438
        if (!$uploadResult) {
@@ 438-448 (lines=11) @@
435
        }
436
437
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
438
        if (!$uploadResult) {
439
            $result = ['message' => [
440
                'type' => 'error',
441
                'value' => _t(
442
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
443
                    'Failed to load file'
444
                )
445
            ]];
446
            return (new HTTPResponse(json_encode($result), 400))
447
                ->addHeader('Content-Type', 'application/json');
448
        }
449
450
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
451
        $file->write();