Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 746-754 (lines=9) @@
743
        /** @var File $file */
744
        $file = $this->getList()->byID($id);
745
746
        if (!$file->canView()) {
747
            $this->httpError(403, _t(
748
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
749
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
750
                '',
751
                ['ObjectTitle' => $file->i18n_singular_name()]
752
            ));
753
            return null;
754
        }
755
756
        $scaffolder = $this->getFormFactory($file);
757
        $form = $scaffolder->getForm($this, 'FileEditForm', [
@@ 794-802 (lines=9) @@
791
792
        $request = $this->getRequest();
793
794
        if (!$file->canView()) {
795
            $this->httpError(403, _t(
796
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
797
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
798
                '',
799
                ['ObjectTitle' => $file->i18n_singular_name()]
800
            ));
801
            return null;
802
        }
803
804
        $versionId = $request->param('OtherItemID');
805
        $version = Versioned::get_version($this->getList()->dataClass(), $id, $versionId);
@@ 1142-1150 (lines=9) @@
1139
            ));
1140
            return null;
1141
        }
1142
        if (!$record->canView()) {
1143
            $this->httpError(403, _t(
1144
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1145
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1146
                '',
1147
                ['ObjectTitle' => $record->i18n_singular_name()]
1148
            ));
1149
            return null;
1150
        }
1151
1152
        $handler = AddToCampaignHandler::create($this, $record);
1153
        $form = $handler->Form($record);