Code Duplication    Length = 9-9 lines in 3 locations

code/Controller/AssetAdmin.php 3 locations

@@ 682-690 (lines=9) @@
679
            return $this->httpError(404);
680
        }
681
682
        if (!$file->canView()) {
683
            $this->httpError(403, _t(
684
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
685
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
686
                '',
687
                ['ObjectTitle' => $file->i18n_singular_name()]
688
            ));
689
            return null;
690
        }
691
692
        $effectiveContext = array_merge($context, ['Record' => $file]);
693
        /** @var FormFactory $scaffolder */
@@ 610-618 (lines=9) @@
607
        /** @var File $file */
608
        $file = File::get()->byID($id);
609
610
        if (!$file->canView()) {
611
            $this->httpError(403, _t(
612
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
613
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
614
                '',
615
                ['ObjectTitle' => $file->i18n_singular_name()]
616
            ));
617
            return null;
618
        }
619
620
        // Pass to form factory
621
        $augmentedContext = array_merge($context, ['Record' => $file]);
@@ 988-996 (lines=9) @@
985
            ));
986
            return null;
987
        }
988
        if (!$record->canView()) {
989
            $this->httpError(403, _t(
990
                'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ErrorItemPermissionDenied',
991
                'You don\'t have the necessary permissions to modify {ObjectTitle}',
992
                '',
993
                ['ObjectTitle' => $record->i18n_singular_name()]
994
            ));
995
            return null;
996
        }
997
998
        $handler = AddToCampaignHandler::create($this, $record, 'addToCampaignForm');
999
        $form = $handler->Form($record);