Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 623-631 (lines=9) @@
620
        /** @var File $file */
621
        $file = File::get()->byID($id);
622
623
        if (!$file->canView()) {
624
            $this->httpError(403, _t(
625
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
626
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
627
                '',
628
                ['ObjectTitle' => $file->i18n_singular_name()]
629
            ));
630
            return null;
631
        }
632
633
        // Pass to form factory
634
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 695-703 (lines=9) @@
692
            return $this->httpError(404);
693
        }
694
695
        if (!$file->canView()) {
696
            $this->httpError(403, _t(
697
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
698
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
699
                '',
700
                ['ObjectTitle' => $file->i18n_singular_name()]
701
            ));
702
            return null;
703
        }
704
705
        $effectiveContext = array_merge($context, ['Record' => $file]);
706
        /** @var FormFactory $scaffolder */
@@ 1001-1009 (lines=9) @@
998
            ));
999
            return null;
1000
        }
1001
        if (!$record->canView()) {
1002
            $this->httpError(403, _t(
1003
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
1004
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
1005
                '',
1006
                ['ObjectTitle' => $record->i18n_singular_name()]
1007
            ));
1008
            return null;
1009
        }
1010
1011
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
1012
        $form = $handler->Form($record);