Code Duplication    Length = 14-14 lines in 5 locations

code/Controller/AssetAdmin.php 5 locations

@@ 622-635 (lines=14) @@
619
     * @param HTTPRequest $request
620
     * @return Form
621
     */
622
    public function fileEditForm($request = null)
623
    {
624
        // Get ID either from posted back value, or url parameter
625
        if (!$request) {
626
            $this->httpError(400);
627
            return null;
628
        }
629
        $id = $request->param('ID');
630
        if (!$id) {
631
            $this->httpError(400);
632
            return null;
633
        }
634
        return $this->getFileEditForm($id);
635
    }
636
637
    /**
638
     * The form is used to generate a form schema,
@@ 662-675 (lines=14) @@
659
     * @param HTTPRequest $request
660
     * @return Form
661
     */
662
    public function fileInsertForm($request = null)
663
    {
664
        // Get ID either from posted back value, or url parameter
665
        if (!$request) {
666
            $this->httpError(400);
667
            return null;
668
        }
669
        $id = $request->param('ID');
670
        if (!$id) {
671
            $this->httpError(400);
672
            return null;
673
        }
674
        return $this->getFileInsertForm($id);
675
    }
676
677
    public function fileUpdateForm($request = null)
678
    {
@@ 677-690 (lines=14) @@
674
        return $this->getFileInsertForm($id);
675
    }
676
677
    public function fileUpdateForm($request = null)
678
    {
679
        // Get ID either from posted back value, or url parameter
680
        if (!$request) {
681
            $this->httpError(400);
682
            return null;
683
        }
684
        $id = $request->param('ID');
685
        if (!$id) {
686
            $this->httpError(400);
687
            return null;
688
        }
689
        return $this->getFileUpdateform($id);
690
    }
691
692
    /**
693
     * The form used to generate a form schema, since it's used directly on API endpoints,
@@ 710-723 (lines=14) @@
707
     * @param HTTPRequest $request
708
     * @return Form
709
     */
710
    public function fileEditorLinkForm($request = null)
711
    {
712
        // Get ID either from posted back value, or url parameter
713
        if (!$request) {
714
            $this->httpError(400);
715
            return null;
716
        }
717
        $id = $request->param('ID');
718
        if (!$id) {
719
            $this->httpError(400);
720
            return null;
721
        }
722
        return $this->getFileInsertForm($id);
723
    }
724
725
    /**
726
     * The form used to generate a form schema, since it's used directly on API endpoints,
@@ 737-750 (lines=14) @@
734
        return $this->getAbstractFileForm($id, 'fileInsertForm', [ 'Type' => AssetFormFactory::TYPE_UPDATE_LINK ]);
735
    }
736
737
    public function fileUpdateEditorLinkForm($request = null)
738
    {
739
        // Get ID either from posted back value, or url parameter
740
        if (!$request) {
741
            $this->httpError(400);
742
            return null;
743
        }
744
        $id = $request->param('ID');
745
        if (!$id) {
746
            $this->httpError(400);
747
            return null;
748
        }
749
        return $this->getFileUpdateForm($id);
750
    }
751
752
    /**
753
     * Abstract method for generating a form for a file