Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 637-645 (lines=9) @@
634
        /** @var File $file */
635
        $file = $this->getList()->byID($id);
636
637
        if (!$file->canView()) {
638
            $this->httpError(403, _t(
639
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
640
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
641
                '',
642
                ['ObjectTitle' => $file->i18n_singular_name()]
643
            ));
644
            return null;
645
        }
646
647
        // Pass to form factory
648
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 709-717 (lines=9) @@
706
            return $this->httpError(404);
707
        }
708
709
        if (!$file->canView()) {
710
            $this->httpError(403, _t(
711
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
712
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
713
                '',
714
                ['ObjectTitle' => $file->i18n_singular_name()]
715
            ));
716
            return null;
717
        }
718
719
        $effectiveContext = array_merge($context, ['Record' => $file]);
720
        /** @var FormFactory $scaffolder */
@@ 1085-1093 (lines=9) @@
1082
            ));
1083
            return null;
1084
        }
1085
        if (!$record->canView()) {
1086
            $this->httpError(403, _t(
1087
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1088
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1089
                '',
1090
                ['ObjectTitle' => $record->i18n_singular_name()]
1091
            ));
1092
            return null;
1093
        }
1094
1095
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1096
        $form = $handler->Form($record);