Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 835-843 (lines=9) @@
832
        /** @var File $file */
833
        $file = $this->getList()->byID($id);
834
835
        if (!$file->canView()) {
836
            $this->httpError(403, _t(
837
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
838
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
839
                '',
840
                ['ObjectTitle' => $file->i18n_singular_name()]
841
            ));
842
            return null;
843
        }
844
845
        // Pass to form factory
846
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 907-915 (lines=9) @@
904
            return $this->httpError(404);
905
        }
906
907
        if (!$file->canView()) {
908
            $this->httpError(403, _t(
909
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
910
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
911
                '',
912
                ['ObjectTitle' => $file->i18n_singular_name()]
913
            ));
914
            return null;
915
        }
916
917
        $effectiveContext = array_merge($context, ['Record' => $file]);
918
        /** @var FormFactory $scaffolder */
@@ 1274-1282 (lines=9) @@
1271
            ));
1272
            return null;
1273
        }
1274
        if (!$record->canView()) {
1275
            $this->httpError(403, _t(
1276
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1277
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1278
                '',
1279
                ['ObjectTitle' => $record->i18n_singular_name()]
1280
            ));
1281
            return null;
1282
        }
1283
1284
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1285
        $form = $handler->Form($record);