Test Failed
Push — master ( 3eb0e4...9196b6 )
by Ivan
02:13
created

Url::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Everlution\Navigation\Item;
6
7
use Everlution\Navigation\Item;
8
use Everlution\Navigation\NavigationItem;
9
use Everlution\Navigation\Uri\SimpleUri;
10
use Everlution\Navigation\Uri\Uri;
11
use Everlution\Navigation\Voter\Exact\ExactMatch;
12
13
/**
14
 * Class Url.
15
 * @author Ivan Barlog <[email protected]>
16
 */
17 View Code Duplication
class Url extends NavigationItem
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    /** @var SimpleUri */
20
    private $uri;
21
22
    public function __construct(string $label, string $url, Item $parent = null, array $children = [])
23
    {
24
        parent::__construct($label, $parent, $children);
25
26
        $this->uri = new SimpleUri($url);
27
        $this->addMatch(new ExactMatch($url));
28
    }
29
30
    /**
31
     * @return SimpleUri|Uri
32
     */
33
    public function getUri(): Uri
34
    {
35
        return $this->uri;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getUrl(): string
42
    {
43
        return $this->uri->getUri();
44
    }
45
}
46