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

Route::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 5
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\RouteUri;
10
use Everlution\Navigation\Uri\Uri;
11
use Everlution\Navigation\Voter\Exact\ExactMatch;
12
13
/**
14
 * Class Route.
15
 * @author Ivan Barlog <[email protected]>
16
 */
17 View Code Duplication
class Route 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 RouteUri */
20
    private $uri;
21
22
    public function __construct(
23
        string $label,
24
        string $route,
25
        array $parameters = [],
26
        Item $parent = null,
27
        array $children = []
28
    ) {
29
        parent::__construct($label, $parent, $children);
30
31
        $this->uri = new RouteUri($route, $parameters);
32
        $this->addMatch(new ExactMatch($route));
33
    }
34
35
    /**
36
     * @return RouteUri|Uri
37
     */
38
    public function getUri(): Uri
39
    {
40
        return $this->uri;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getRoute(): string
47
    {
48
        return $this->uri->getRoute();
49
    }
50
51
    /**
52
     * @return array
53
     */
54
    public function getRouteParameters(): array
55
    {
56
        return $this->uri->getParameters();
57
    }
58
}
59