Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 914-922 (lines=9) @@
911
        /** @var File $file */
912
        $file = $this->getList()->byID($id);
913
914
        if (!$file->canView()) {
915
            $this->httpError(403, _t(
916
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
917
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
918
                '',
919
                ['ObjectTitle' => $file->i18n_singular_name()]
920
            ));
921
            return null;
922
        }
923
924
        // Pass to form factory
925
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 986-994 (lines=9) @@
983
            return $this->httpError(404);
984
        }
985
986
        if (!$file->canView()) {
987
            $this->httpError(403, _t(
988
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
989
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
990
                '',
991
                ['ObjectTitle' => $file->i18n_singular_name()]
992
            ));
993
            return null;
994
        }
995
996
        $effectiveContext = array_merge($context, ['Record' => $file]);
997
        /** @var FormFactory $scaffolder */
@@ 1359-1367 (lines=9) @@
1356
            ));
1357
            return null;
1358
        }
1359
        if (!$record->canView()) {
1360
            $this->httpError(403, _t(
1361
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1362
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1363
                '',
1364
                ['ObjectTitle' => $record->i18n_singular_name()]
1365
            ));
1366
            return null;
1367
        }
1368
1369
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1370
        $form = $handler->Form($record);