Passed
Push — main ( 11cd55...a13e4a )
by Michael
11:21
created

MenuItem::linkToUrl()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 1
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Braunstetter\MenuBundle\Factory;
5
6
7
use Braunstetter\MenuBundle\Items\RouteMenuItem;
8
use Braunstetter\MenuBundle\Items\SectionMenuItem;
9
use Braunstetter\MenuBundle\Items\SystemMenuItem;
10
use Braunstetter\MenuBundle\Items\UrlMenuItem;
11
use Braunstetter\MenuBundle\Items\MenuItem as Item;
12
13
final class MenuItem
14
{
15
16
    public static function linkToRoute(string $label, string $routeName, array $routeParameters = [], ?string $icon = null): RouteMenuItem
17
    {
18
        return new RouteMenuItem($label, $routeName, $routeParameters, $icon);
19
    }
20
21
    public static function section(string $label, string $routeName, array $routeParameters = [], ?string $icon = null): SectionMenuItem
22
    {
23
        return new SectionMenuItem($label, $routeName, $routeParameters, $icon);
24
    }
25
26
    public static function system(string $label, string $routeName, array $routeParameters = [], ?string $icon = null): SystemMenuItem
27
    {
28
        return new SystemMenuItem($label, $routeName, $routeParameters, $icon);
29
    }
30
31
    public static function linkToUrl(string $label, string $url, ?string $target = null, ?string $icon = null): UrlMenuItem
32
    {
33
        return new UrlMenuItem($label, $url, $target ?: Item::TARGET_DEFAULT, $icon);
34
    }
35
36
}