Completed
Push — refactoring ( 84ac1f...ab1ebc )
by Oleg
04:25
created

Link   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 58
wmc 7
lcom 2
cbo 2
ccs 19
cts 19
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getTitle() 0 4 1
A setTitle() 0 6 2
A getUrl() 0 4 1
A setUrl() 0 6 2
1
<?php
2
3
namespace Malezha\Menu\Entity;
4
5
use Malezha\Menu\Traits\HasAttributes;
6
7
class Link
8
{
9
    use HasAttributes;
10
11
    /**
12
     * @var string
13
     */
14
    protected $url;
15
16
    /**
17
     * @var string
18
     */
19
    protected $title;
20
21
22 12
    function __construct($title = '', $url = '#', $attributes = [])
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
    {
24 12
        $this->title = $title;
25 12
        $this->url = $url;
26 12
        $this->attributes = new Attributes($attributes);
27 12
    }
28
29
    /**
30
     * @return string
31
     */
32 3
    public function getTitle()
33
    {
34 3
        return $this->title;
35
    }
36
37
    /**
38
     * @param string $title
39
     */
40 3
    public function setTitle($title)
41
    {
42 3
        if (!empty($title)) {
43 3
            $this->title = (string) $title;
44 3
        }
45 3
    }
46
47
    /**
48
     * @return string
49
     */
50 4
    public function getUrl()
51
    {
52 4
        return $this->url;
53
    }
54
55
    /**
56
     * @param string $url
57
     */
58 2
    public function setUrl($url)
59
    {
60 2
        if (!empty($url)) {
61 2
            $this->url = (string) $url;
62 2
        }
63
    }
64
}