Completed
Push — master ( 15f051...29343b )
by Oleg
05:33
created

Link::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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
}