Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

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