Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 231-241 (lines=11) @@
228
        $file = Injector::inst()->create($fileClass);
229
230
        // check canCreate permissions
231
        if (!$file->canCreate(null, $data)) {
232
            $result = ['message' => [
233
                'type' => 'error',
234
                'value' => _t(
235
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
236
                    'You do not have permission to add files'
237
                )
238
            ]];
239
            return (new HTTPResponse(json_encode($result), 403))
240
                ->addHeader('Content-Type', 'application/json');
241
        }
242
243
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
244
        if (!$uploadResult) {
@@ 244-254 (lines=11) @@
241
        }
242
243
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
244
        if (!$uploadResult) {
245
            $result = ['message' => [
246
                'type' => 'error',
247
                'value' => _t(
248
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
249
                    'Failed to load file'
250
                )
251
            ]];
252
            return (new HTTPResponse(json_encode($result), 400))
253
                ->addHeader('Content-Type', 'application/json');
254
        }
255
256
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
257
        $file->write();