Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 807-815 (lines=9) @@
804
        /** @var File $file */
805
        $file = $this->getList()->byID($id);
806
807
        if (!$file->canView()) {
808
            $this->httpError(403, _t(
809
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
810
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
811
                '',
812
                ['ObjectTitle' => $file->i18n_singular_name()]
813
            ));
814
            return null;
815
        }
816
817
        // Pass to form factory
818
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 871-879 (lines=9) @@
868
            return $this->httpError(404);
869
        }
870
871
        if (!$file->canView()) {
872
            $this->httpError(403, _t(
873
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
874
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
875
                '',
876
                ['ObjectTitle' => $file->i18n_singular_name()]
877
            ));
878
            return null;
879
        }
880
881
        $effectiveContext = array_merge($context, ['Record' => $file]);
882
        /** @var FormFactory $scaffolder */
@@ 1247-1255 (lines=9) @@
1244
            ));
1245
            return null;
1246
        }
1247
        if (!$record->canView()) {
1248
            $this->httpError(403, _t(
1249
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1250
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1251
                '',
1252
                ['ObjectTitle' => $record->i18n_singular_name()]
1253
            ));
1254
            return null;
1255
        }
1256
1257
        $handler = AddToCampaignHandler::create($this, $record);
1258
        $form = $handler->Form($record);