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

@@ 156-176 (lines=21) @@
153
     *
154
     * @return $this
155
     */
156
    public function dropdown($title, \Closure $callback, $order = 0, array $attributes = array())
157
    {
158
        $properties = compact('title', 'order', 'attributes');
159
160
        if (func_num_args() === 3) {
161
            $arguments = func_get_args();
162
163
            $title = array_get($arguments, 0);
164
            $attributes = array_get($arguments, 2);
165
166
            $properties = compact('title', 'attributes');
167
        }
168
169
        $child = static::make($properties);
170
171
        call_user_func($callback, $child);
172
173
        $this->childs[] = $child;
174
175
        return $child;
176
    }
177
178
    /**
179
     * Create new menu item and set the action to route.