Code Duplication    Length = 9-9 lines in 4 locations

code/Controller/AssetAdmin.php 4 locations

@@ 785-793 (lines=9) @@
782
        /** @var File $file */
783
        $file = $this->getList()->byID($id);
784
785
        if (!$file->canView()) {
786
            $this->httpError(403, _t(
787
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
788
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
789
                '',
790
                ['ObjectTitle' => $file->i18n_singular_name()]
791
            ));
792
            return null;
793
        }
794
795
        $scaffolder = $this->getFormFactory($file);
796
        $form = $scaffolder->getForm($this, 'FileEditForm', [
@@ 837-845 (lines=9) @@
834
        /** @var File $file */
835
        $file = $this->getList()->byID($id);
836
837
        if (!$file->canView()) {
838
            $this->httpError(403, _t(
839
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
840
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
841
                '',
842
                ['ObjectTitle' => $file->i18n_singular_name()]
843
            ));
844
            return null;
845
        }
846
847
        $scaffolder = $this->getFormFactory($file);
848
        $form = $scaffolder->getForm($this, 'FileInsertForm', [
@@ 892-900 (lines=9) @@
889
            return $this->httpError(404);
890
        }
891
892
        if (!$file->canView()) {
893
            $this->httpError(403, _t(
894
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
895
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
896
                '',
897
                ['ObjectTitle' => $file->i18n_singular_name()]
898
            ));
899
            return null;
900
        }
901
902
        $effectiveContext = array_merge($context, ['Record' => $file]);
903
        /** @var FormFactory $scaffolder */
@@ 1270-1278 (lines=9) @@
1267
            ));
1268
            return null;
1269
        }
1270
        if (!$record->canView()) {
1271
            $this->httpError(403, _t(
1272
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1273
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1274
                '',
1275
                ['ObjectTitle' => $record->i18n_singular_name()]
1276
            ));
1277
            return null;
1278
        }
1279
1280
        $handler = AddToCampaignHandler::create($this, $record);
1281
        $form = $handler->Form($record);