Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 577-585 (lines=9) @@
574
        /** @var File $file */
575
        $file = File::get()->byID($id);
576
577
        if (!$file->canView()) {
578
            $this->httpError(403, _t(
579
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
580
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
581
                '',
582
                ['ObjectTitle' => $file->i18n_singular_name()]
583
            ));
584
            return null;
585
        }
586
587
        // Pass to form factory
588
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 649-657 (lines=9) @@
646
            return $this->httpError(404);
647
        }
648
649
        if (!$file->canView()) {
650
            $this->httpError(403, _t(
651
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
652
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
653
                '',
654
                ['ObjectTitle' => $file->i18n_singular_name()]
655
            ));
656
            return null;
657
        }
658
659
        $effectiveContext = array_merge($context, ['Record' => $file]);
660
        /** @var FormFactory $scaffolder */
@@ 955-963 (lines=9) @@
952
            ));
953
            return null;
954
        }
955
        if (!$record->canView()) {
956
            $this->httpError(403, _t(
957
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
958
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
959
                '',
960
                ['ObjectTitle' => $record->i18n_singular_name()]
961
            ));
962
            return null;
963
        }
964
965
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
966
        $form = $handler->Form($record);