Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 760-768 (lines=9) @@
757
        /** @var File $file */
758
        $file = $this->getList()->byID($id);
759
760
        if (!$file->canView()) {
761
            $this->httpError(403, _t(
762
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
763
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
764
                '',
765
                ['ObjectTitle' => $file->i18n_singular_name()]
766
            ));
767
            return null;
768
        }
769
770
        // Pass to form factory
771
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 832-840 (lines=9) @@
829
            return $this->httpError(404);
830
        }
831
832
        if (!$file->canView()) {
833
            $this->httpError(403, _t(
834
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
835
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
836
                '',
837
                ['ObjectTitle' => $file->i18n_singular_name()]
838
            ));
839
            return null;
840
        }
841
842
        $effectiveContext = array_merge($context, ['Record' => $file]);
843
        /** @var FormFactory $scaffolder */
@@ 1187-1195 (lines=9) @@
1184
            ));
1185
            return null;
1186
        }
1187
        if (!$record->canView()) {
1188
            $this->httpError(403, _t(
1189
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1190
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1191
                '',
1192
                ['ObjectTitle' => $record->i18n_singular_name()]
1193
            ));
1194
            return null;
1195
        }
1196
1197
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1198
        $form = $handler->Form($record);