Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 357-367 (lines=11) @@
354
        $file = Injector::inst()->create($fileClass);
355
356
        // check canCreate permissions
357
        if (!$file->canCreate(null, $data)) {
358
            $result = ['message' => [
359
                'type' => 'error',
360
                'value' => _t(
361
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
362
                    'You do not have permission to add files'
363
                )
364
            ]];
365
            return (new HTTPResponse(json_encode($result), 403))
366
                ->addHeader('Content-Type', 'application/json');
367
        }
368
369
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
370
        if(!$uploadResult) {
@@ 370-380 (lines=11) @@
367
        }
368
369
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
370
        if(!$uploadResult) {
371
            $result = ['message' => [
372
                'type' => 'error',
373
                'value' => _t(
374
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
375
                    'Failed to load file'
376
                )
377
            ]];
378
            return (new HTTPResponse(json_encode($result), 400))
379
                ->addHeader('Content-Type', 'application/json');
380
        }
381
382
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
383
        $file->write();