SidebarExtender   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 38
wmc 2
lcom 1
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A extendWith() 0 15 1
1
<?php
2
3
namespace Modules\Tag\Sidebar;
4
5
use Maatwebsite\Sidebar\Group;
6
use Maatwebsite\Sidebar\Item;
7
use Maatwebsite\Sidebar\Menu;
8
use Modules\User\Contracts\Authentication;
9
10
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender
11
{
12
    /**
13
     * @var Authentication
14
     */
15
    protected $auth;
16
17
    /**
18
     * @param Authentication $auth
19
     *
20
     * @internal param Guard $guard
21
     */
22
    public function __construct(Authentication $auth)
23
    {
24
        $this->auth = $auth;
25
    }
26
27
    /**
28
     * @param Menu $menu
29
     *
30
     * @return Menu
31
     */
32
    public function extendWith(Menu $menu)
33
    {
34
        $menu->group(trans('core::sidebar.content'), function (Group $group) {
35
            $group->item(trans('tag::tags.tags'), function (Item $item) {
36
                $item->icon('fa fa-tag');
37
                $item->weight(0);
38
                $item->route('admin.tag.tag.index');
39
                $item->authorize(
40
                    $this->auth->hasAccess('tag.tags.index')
41
                );
42
            });
43
        });
44
45
        return $menu;
46
    }
47
}
48