Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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