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 */
@@ 1232-1240 (lines=9) @@
1229
            ));
1230
            return null;
1231
        }
1232
        if (!$record->canView()) {
1233
            $this->httpError(403, _t(
1234
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1235
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1236
                '',
1237
                ['ObjectTitle' => $record->i18n_singular_name()]
1238
            ));
1239
            return null;
1240
        }
1241
1242
        $handler = AddToCampaignHandler::create($this, $record);
1243
        $form = $handler->Form($record);