Code Duplication    Length = 13-13 lines in 3 locations

src/Ui/Form/FormBuilder.php 1 location

@@ 694-706 (lines=13) @@
691
     * @param null $position
692
     * @return $this
693
     */
694
    public function addSection($slug, array $section, $position = null)
695
    {
696
        if ($position === null) {
697
            $position = count($this->sections) + 1;
698
        }
699
700
        $front = array_slice($this->sections, 0, $position, true);
701
        $back  = array_slice($this->sections, $position, count($this->sections) - $position, true);
702
703
        $this->sections = $front + [$slug => $section] + $back;
704
705
        return $this;
706
    }
707
708
    /**
709
     * Add a section tab.

src/Addon/Module/Module.php 1 location

@@ 102-114 (lines=13) @@
99
     * @param null   $position
100
     * @return $this
101
     */
102
    public function addSection($slug, array $section, $position = null)
103
    {
104
        if ($position === null) {
105
            $position = count($this->sections) + 1;
106
        }
107
108
        $front = array_slice($this->sections, 0, $position, true);
109
        $back  = array_slice($this->sections, $position, count($this->sections) - $position, true);
110
111
        $this->sections = $front + [$slug => $section] + $back;
112
113
        return $this;
114
    }
115
116
    /**
117
     * Add a section button.

src/Ui/ControlPanel/ControlPanelBuilder.php 1 location

@@ 130-142 (lines=13) @@
127
     * @param null   $position
128
     * @return $this
129
     */
130
    public function addSection($slug, array $section, $position = null)
131
    {
132
        if ($position === null) {
133
            $position = count($this->sections) + 1;
134
        }
135
136
        $front = array_slice($this->sections, 0, $position, true);
137
        $back  = array_slice($this->sections, $position, count($this->sections) - $position, true);
138
139
        $this->sections = $front + [$slug => $section] + $back;
140
141
        return $this;
142
    }
143
144
    /**
145
     * Add a section button.