Code Duplication    Length = 13-13 lines in 3 locations

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.

src/Ui/Form/FormBuilder.php 1 location

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