Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 398-408 (lines=11) @@
395
        $file = Injector::inst()->create($fileClass);
396
397
        // check canCreate permissions
398
        if (!$file->canCreate(null, $data)) {
399
            $result = ['message' => [
400
                'type' => 'error',
401
                'value' => _t(
402
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
403
                    'You do not have permission to add files'
404
                )
405
            ]];
406
            return (new HTTPResponse(json_encode($result), 403))
407
                ->addHeader('Content-Type', 'application/json');
408
        }
409
410
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
411
        if (!$uploadResult) {
@@ 411-421 (lines=11) @@
408
        }
409
410
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
411
        if (!$uploadResult) {
412
            $result = ['message' => [
413
                'type' => 'error',
414
                'value' => _t(
415
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
416
                    'Failed to load file'
417
                )
418
            ]];
419
            return (new HTTPResponse(json_encode($result), 400))
420
                ->addHeader('Content-Type', 'application/json');
421
        }
422
423
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
424
        $file->write();