Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 273-283 (lines=11) @@
270
        $file = Injector::inst()->create($fileClass);
271
272
        // check canCreate permissions
273
        if (!$file->canCreate(null, $data)) {
274
            $result = ['message' => [
275
                'type' => 'error',
276
                'value' => _t(
277
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
278
                    'You do not have permission to add files'
279
                )
280
            ]];
281
            return (new HTTPResponse(json_encode($result), 403))
282
                ->addHeader('Content-Type', 'application/json');
283
        }
284
285
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
286
        if (!$uploadResult) {
@@ 286-296 (lines=11) @@
283
        }
284
285
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
286
        if (!$uploadResult) {
287
            $result = ['message' => [
288
                'type' => 'error',
289
                'value' => _t(
290
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
291
                    'Failed to load file'
292
                )
293
            ]];
294
            return (new HTTPResponse(json_encode($result), 400))
295
                ->addHeader('Content-Type', 'application/json');
296
        }
297
298
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
299
        $file->write();