Code Duplication    Length = 14-14 lines in 5 locations

code/Controller/AssetAdmin.php 5 locations

@@ 623-636 (lines=14) @@
620
     * @param HTTPRequest $request
621
     * @return Form
622
     */
623
    public function fileEditForm($request = null)
624
    {
625
        // Get ID either from posted back value, or url parameter
626
        if (!$request) {
627
            $this->httpError(400);
628
            return null;
629
        }
630
        $id = $request->param('ID');
631
        if (!$id) {
632
            $this->httpError(400);
633
            return null;
634
        }
635
        return $this->getFileEditForm($id);
636
    }
637
638
    /**
639
     * The form is used to generate a form schema,
@@ 658-671 (lines=14) @@
655
     * @param HTTPRequest $request
656
     * @return Form
657
     */
658
    public function fileInsertForm($request = null)
659
    {
660
        // Get ID either from posted back value, or url parameter
661
        if (!$request) {
662
            $this->httpError(400);
663
            return null;
664
        }
665
        $id = $request->param('ID');
666
        if (!$id) {
667
            $this->httpError(400);
668
            return null;
669
        }
670
        return $this->getFileInsertForm($id);
671
    }
672
673
    /**
674
     * Similar to {@see AssetAdmin::getFileInsertForm()} but with Update button
@@ 691-704 (lines=14) @@
688
     * @param HTTPRequest $request
689
     * @return Form
690
     */
691
    public function fileUpdateForm($request = null)
692
    {
693
        // Get ID either from posted back value, or url parameter
694
        if (!$request) {
695
            $this->httpError(400);
696
            return null;
697
        }
698
        $id = $request->param('ID');
699
        if (!$id) {
700
            $this->httpError(400);
701
            return null;
702
        }
703
        return $this->getFileUpdateform($id);
704
    }
705
706
    /**
707
     * The form used to generate a form schema, since it's used directly on API endpoints,
@@ 724-737 (lines=14) @@
721
     * @param HTTPRequest $request
722
     * @return Form
723
     */
724
    public function fileEditorLinkForm($request = null)
725
    {
726
        // Get ID either from posted back value, or url parameter
727
        if (!$request) {
728
            $this->httpError(400);
729
            return null;
730
        }
731
        $id = $request->param('ID');
732
        if (!$id) {
733
            $this->httpError(400);
734
            return null;
735
        }
736
        return $this->getFileInsertForm($id);
737
    }
738
739
    /**
740
     * The form used to generate a form schema, since it's used directly on API endpoints,
@@ 757-770 (lines=14) @@
754
     * @param HTTPRequest $request
755
     * @return Form
756
     */
757
    public function fileUpdateEditorLinkForm($request = null)
758
    {
759
        // Get ID either from posted back value, or url parameter
760
        if (!$request) {
761
            $this->httpError(400);
762
            return null;
763
        }
764
        $id = $request->param('ID');
765
        if (!$id) {
766
            $this->httpError(400);
767
            return null;
768
        }
769
        return $this->getFileUpdateForm($id);
770
    }
771
772
    /**
773
     * Abstract method for generating a form for a file