Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

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