Code Duplication    Length = 9-9 lines in 4 locations

code/Controller/AssetAdmin.php 4 locations

@@ 749-757 (lines=9) @@
746
        /** @var File $file */
747
        $file = $this->getList()->byID($id);
748
749
        if (!$file->canView()) {
750
            $this->httpError(403, _t(
751
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
752
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
753
                '',
754
                ['ObjectTitle' => $file->i18n_singular_name()]
755
            ));
756
            return null;
757
        }
758
759
        $scaffolder = $this->getFormFactory($file);
760
        $form = $scaffolder->getForm($this, 'FileEditForm', [
@@ 801-809 (lines=9) @@
798
        /** @var File $file */
799
        $file = $this->getList()->byID($id);
800
801
        if (!$file->canView()) {
802
            $this->httpError(403, _t(
803
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
804
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
805
                '',
806
                ['ObjectTitle' => $file->i18n_singular_name()]
807
            ));
808
            return null;
809
        }
810
811
        $scaffolder = $this->getFormFactory($file);
812
        $form = $scaffolder->getForm($this, 'FileInsertForm', [
@@ 856-864 (lines=9) @@
853
            return $this->httpError(404);
854
        }
855
856
        if (!$file->canView()) {
857
            $this->httpError(403, _t(
858
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
859
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
860
                '',
861
                ['ObjectTitle' => $file->i18n_singular_name()]
862
            ));
863
            return null;
864
        }
865
866
        $effectiveContext = array_merge($context, ['Record' => $file]);
867
        /** @var FormFactory $scaffolder */
@@ 1228-1236 (lines=9) @@
1225
            ));
1226
            return null;
1227
        }
1228
        if (!$record->canView()) {
1229
            $this->httpError(403, _t(
1230
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1231
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1232
                '',
1233
                ['ObjectTitle' => $record->i18n_singular_name()]
1234
            ));
1235
            return null;
1236
        }
1237
1238
        $handler = AddToCampaignHandler::create($this, $record);
1239
        $form = $handler->Form($record);