Code Duplication    Length = 9-9 lines in 4 locations

code/Controller/AssetAdmin.php 4 locations

@@ 751-759 (lines=9) @@
748
        /** @var File $file */
749
        $file = $this->getList()->byID($id);
750
751
        if (!$file->canView()) {
752
            $this->httpError(403, _t(
753
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
754
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
755
                '',
756
                ['ObjectTitle' => $file->i18n_singular_name()]
757
            ));
758
            return null;
759
        }
760
761
        $scaffolder = $this->getFormFactory($file);
762
        $form = $scaffolder->getForm($this, 'fileEditForm', [
@@ 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
        $scaffolder = $this->getFormFactory($file);
814
        $form = $scaffolder->getForm($this, 'fileInsertForm', [
@@ 858-866 (lines=9) @@
855
            return $this->httpError(404);
856
        }
857
858
        if (!$file->canView()) {
859
            $this->httpError(403, _t(
860
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
861
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
862
                '',
863
                ['ObjectTitle' => $file->i18n_singular_name()]
864
            ));
865
            return null;
866
        }
867
868
        $effectiveContext = array_merge($context, ['Record' => $file]);
869
        /** @var FormFactory $scaffolder */
@@ 1217-1225 (lines=9) @@
1214
            ));
1215
            return null;
1216
        }
1217
        if (!$record->canView()) {
1218
            $this->httpError(403, _t(
1219
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1220
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1221
                '',
1222
                ['ObjectTitle' => $record->i18n_singular_name()]
1223
            ));
1224
            return null;
1225
        }
1226
1227
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1228
        $form = $handler->Form($record);