Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 714-722 (lines=9) @@
711
            return null;
712
        }
713
714
        if (!$file->canView()) {
715
            $this->httpError(403, _t(
716
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
717
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
718
                '',
719
                ['ObjectTitle' => $file->i18n_singular_name()]
720
            ));
721
            return null;
722
        }
723
724
        // Pass to form factory
725
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 791-799 (lines=9) @@
788
            return $this->httpError(404);
789
        }
790
791
        if (!$file->canView()) {
792
            $this->httpError(403, _t(
793
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
794
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
795
                '',
796
                ['ObjectTitle' => $file->i18n_singular_name()]
797
            ));
798
            return null;
799
        }
800
801
        $effectiveContext = array_merge($context, ['Record' => $file]);
802
        /** @var FormFactory $scaffolder */
@@ 1158-1166 (lines=9) @@
1155
            ));
1156
            return null;
1157
        }
1158
        if (!$record->canView()) {
1159
            $this->httpError(403, _t(
1160
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1161
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1162
                '',
1163
                ['ObjectTitle' => $record->i18n_singular_name()]
1164
            ));
1165
            return null;
1166
        }
1167
1168
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1169
        $form = $handler->Form($record);