Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 5c7169...b34131 )
by Mark
08:19 queued 05:45
created

NavItem   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 89
rs 10
c 0
b 0
f 0
wmc 7
lcom 2
cbo 2

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A addChild() 0 4 1
A classState() 0 4 2
A url() 0 4 1
A title() 0 4 1
A target() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Marky
5
 * Date: 30/12/2017
6
 * Time: 18:47.
7
 */
8
9
namespace App\Classes\Library\PageLoader;
10
11
/*
12
 * Class NavItem
13
 *
14
 * @package App\Classes\Library\PageLoader
15
 */
16
17
use App\Model\Menu;
18
use Illuminate\Support\Collection;
19
20
/**
21
 * Class NavItem.
22
 */
23
class NavItem
24
{
25
    /**
26
     * @var string
27
     */
28
    protected $text;
29
30
    /**
31
     * @var string
32
     */
33
    protected $url = '#';
34
35
    /**
36
     * @var int
37
     */
38
    protected $order;
39
40
    /**
41
     * @var string
42
     */
43
    protected $target;
44
45
    /**
46
     * @var bool
47
     */
48
    protected $active = false;
49
50
    /**
51
     * @var Collection
52
     */
53
    public $children = [];
54
55
    /**
56
     * NavItem constructor.
57
     *
58
     * @param Menu $menu
59
     * @param bool $active
60
     */
61
    public function __construct(Menu $menu, bool $active = false)
62
    {
63
        $this->text = $menu->title;
64
65
        $this->url = $menu->link();
66
67
        $this->active = $active;
68
69
        $this->children = new Collection;
70
    }
71
72
    /**
73
     * @param NavItem $navItem
0 ignored issues
show
Documentation introduced by
Should the type for parameter $navItem not be \self?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
74
     */
75
    public function addChild(self $navItem)
76
    {
77
        $this->children->put($navItem->text, $navItem);
78
    }
79
80
    /**
81
     * @return bool
0 ignored issues
show
Documentation introduced by
Should the return type not be string?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
82
     */
83
    public function classState()
84
    {
85
        return $this->active ? 'active' : 'inactive';
86
    }
87
88
    /**
89
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be \Illuminate\Contracts\Routing\UrlGenerator|string?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
90
     */
91
    public function url()
92
    {
93
        return url($this->url);
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function title()
100
    {
101
        return $this->text;
102
    }
103
104
    /**
105
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
106
     */
107
    public function target()
108
    {
109
        return $this->target;
110
    }
111
}
112