Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 803-811 (lines=9) @@
800
        /** @var File $file */
801
        $file = $this->getList()->byID($id);
802
803
        if (!$file->canView()) {
804
            $this->httpError(403, _t(
805
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
806
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
807
                '',
808
                ['ObjectTitle' => $file->i18n_singular_name()]
809
            ));
810
            return null;
811
        }
812
813
        // Pass to form factory
814
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 875-883 (lines=9) @@
872
            return $this->httpError(404);
873
        }
874
875
        if (!$file->canView()) {
876
            $this->httpError(403, _t(
877
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
878
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
879
                '',
880
                ['ObjectTitle' => $file->i18n_singular_name()]
881
            ));
882
            return null;
883
        }
884
885
        $effectiveContext = array_merge($context, ['Record' => $file]);
886
        /** @var FormFactory $scaffolder */
@@ 1234-1242 (lines=9) @@
1231
            ));
1232
            return null;
1233
        }
1234
        if (!$record->canView()) {
1235
            $this->httpError(403, _t(
1236
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1237
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1238
                '',
1239
                ['ObjectTitle' => $record->i18n_singular_name()]
1240
            ));
1241
            return null;
1242
        }
1243
1244
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1245
        $form = $handler->Form($record);