Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 673-681 (lines=9) @@
670
            return null;
671
        }
672
673
        if (!$file->canView()) {
674
            $this->httpError(403, _t(
675
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
676
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
677
                '',
678
                ['ObjectTitle' => $file->i18n_singular_name()]
679
            ));
680
            return null;
681
        }
682
683
        // Pass to form factory
684
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 750-758 (lines=9) @@
747
            return $this->httpError(404);
748
        }
749
750
        if (!$file->canView()) {
751
            $this->httpError(403, _t(
752
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
753
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
754
                '',
755
                ['ObjectTitle' => $file->i18n_singular_name()]
756
            ));
757
            return null;
758
        }
759
760
        $effectiveContext = array_merge($context, ['Record' => $file]);
761
        /** @var FormFactory $scaffolder */
@@ 1117-1125 (lines=9) @@
1114
            ));
1115
            return null;
1116
        }
1117
        if (!$record->canView()) {
1118
            $this->httpError(403, _t(
1119
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1120
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1121
                '',
1122
                ['ObjectTitle' => $record->i18n_singular_name()]
1123
            ));
1124
            return null;
1125
        }
1126
1127
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1128
        $form = $handler->Form($record);