Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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