Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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