Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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