Code Duplication    Length = 9-9 lines in 4 locations

code/Controller/AssetAdmin.php 4 locations

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