Code Duplication    Length = 17-17 lines in 3 locations

src/Addon/Module/Module.php 1 location

@@ 125-141 (lines=17) @@
122
     * @param null   $position
123
     * @return $this
124
     */
125
    public function addSectionButton($section, $slug, array $button, $position = null)
126
    {
127
        $buttons = (array)array_get($this->sections, "{$section}.buttons");
128
129
        if ($position === null) {
130
            $position = count($buttons) + 1;
131
        }
132
133
        $front = array_slice($buttons, 0, $position, true);
134
        $back  = array_slice($buttons, $position, count($buttons) - $position, true);
135
136
        $buttons = $front + [$slug => $button] + $back;
137
138
        array_set($this->sections, "{$section}.buttons", $buttons);
139
140
        return $this;
141
    }
142
143
    /**
144
     * Get the module's menu.

src/Ui/ControlPanel/ControlPanelBuilder.php 1 location

@@ 153-169 (lines=17) @@
150
     * @param null   $position
151
     * @return $this
152
     */
153
    public function addSectionButton($section, $slug, array $button, $position = null)
154
    {
155
        $buttons = (array)array_get($this->sections, "{$section}.buttons");
156
157
        if ($position === null) {
158
            $position = count($buttons) + 1;
159
        }
160
161
        $front = array_slice($buttons, 0, $position, true);
162
        $back  = array_slice($buttons, $position, count($buttons) - $position, true);
163
164
        $buttons = $front + [$slug => $button] + $back;
165
166
        array_set($this->sections, "{$section}.buttons", $buttons);
167
168
        return $this;
169
    }
170
171
    /**
172
     * Get the module navigation.

src/Ui/Form/FormBuilder.php 1 location

@@ 715-731 (lines=17) @@
712
     * @param null   $position
713
     * @return $this
714
     */
715
    public function addSectionTab($section, $slug, array $tab, $position = null)
716
    {
717
        $tabs = (array)array_get($this->sections, "{$section}.tabs");
718
719
        if ($position === null) {
720
            $position = count($tabs) + 1;
721
        }
722
723
        $front = array_slice($tabs, 0, $position, true);
724
        $back  = array_slice($tabs, $position, count($tabs) - $position, true);
725
726
        $tabs = $front + [$slug => $tab] + $back;
727
728
        array_set($this->sections, "{$section}.tabs", $tabs);
729
730
        return $this;
731
    }
732
733
    /**
734
     * Get an option value.