Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 380-390 (lines=11) @@
377
        $file = Injector::inst()->create($fileClass);
378
379
        // check canCreate permissions
380
        if (!$file->canCreate(null, $data)) {
381
            $result = ['message' => [
382
                'type' => 'error',
383
                'value' => _t(
384
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
385
                    'You do not have permission to add files'
386
                )
387
            ]];
388
            return (new HTTPResponse(json_encode($result), 403))
389
                ->addHeader('Content-Type', 'application/json');
390
        }
391
392
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
393
        if (!$uploadResult) {
@@ 393-403 (lines=11) @@
390
        }
391
392
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
393
        if (!$uploadResult) {
394
            $result = ['message' => [
395
                'type' => 'error',
396
                'value' => _t(
397
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
398
                    'Failed to load file'
399
                )
400
            ]];
401
            return (new HTTPResponse(json_encode($result), 400))
402
                ->addHeader('Content-Type', 'application/json');
403
        }
404
405
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
406
        $file->write();