Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 219-229 (lines=11) @@
216
        $file = Injector::inst()->create($fileClass);
217
218
        // check canCreate permissions
219
        if (!$file->canCreate(null, $data)) {
220
            $result = ['message' => [
221
                'type' => 'error',
222
                'value' => _t(
223
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
224
                    'You do not have permission to add files'
225
                )
226
            ]];
227
            return (new HTTPResponse(json_encode($result), 403))
228
                ->addHeader('Content-Type', 'application/json');
229
        }
230
231
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
232
        if (!$uploadResult) {
@@ 232-242 (lines=11) @@
229
        }
230
231
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
232
        if (!$uploadResult) {
233
            $result = ['message' => [
234
                'type' => 'error',
235
                'value' => _t(
236
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
237
                    'Failed to load file'
238
                )
239
            ]];
240
            return (new HTTPResponse(json_encode($result), 400))
241
                ->addHeader('Content-Type', 'application/json');
242
        }
243
244
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
245
        $file->write();