Code Duplication    Length = 21-21 lines in 2 locations

src/MenuBuilder.php 1 location

@@ 347-367 (lines=21) @@
344
     *
345
     * @return $this
346
     */
347
    public function dropdown($title, \Closure $callback, $order = null, array $attributes = array())
348
    {
349
        $properties = compact('title', 'order', 'attributes');
350
351
        if (func_num_args() == 3) {
352
            $arguments = func_get_args();
353
354
            $title = array_get($arguments, 0);
355
            $attributes = array_get($arguments, 2);
356
357
            $properties = compact('title', 'attributes');
358
        }
359
360
        $item = MenuItem::make($properties);
361
362
        call_user_func($callback, $item);
363
364
        $this->items[] = $item;
365
366
        return $item;
367
    }
368
369
    /**
370
     * Register new menu item using registered route.

src/MenuItem.php 1 location

@@ 177-197 (lines=21) @@
174
     *
175
     * @return $this
176
     */
177
    public function dropdown($title, \Closure $callback, $order = 0, array $attributes = array())
178
    {
179
        $properties = compact('title', 'order', 'attributes');
180
181
        if (func_num_args() === 3) {
182
            $arguments = func_get_args();
183
184
            $title = array_get($arguments, 0);
185
            $attributes = array_get($arguments, 2);
186
187
            $properties = compact('title', 'attributes');
188
        }
189
190
        $child = static::make($properties);
191
192
        call_user_func($callback, $child);
193
194
        $this->childs[] = $child;
195
196
        return $child;
197
    }
198
199
    /**
200
     * Create new menu item and set the action to route.