Passed
Push — master ( c227df...528f97 )
by Petr
07:58
created

External   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 34
rs 10
ccs 9
cts 9
cp 1
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A link() 0 7 2
1
<?php
2
3
namespace kalanis\kw_routed_paths\Linking;
4
5
6
/**
7
 * Class Link
8
 * @package kalanis\kw_routed_paths\Linking
9
 */
10
class External
11
{
12
    /** @var Link */
13
    protected $lib = null;
14
    /** @var string[] */
15
    protected $presetPath = [];
16
    /** @var string|null */
17
    protected $userName = null;
18
19
    /**
20
     * @param Link $lib
21
     * @param string[] $presetPath
22
     * @param string|null $userName
23
     */
24 5
    public function __construct(Link $lib, array $presetPath, ?string $userName = null)
25
    {
26 5
        $this->lib = $lib;
27 5
        $this->presetPath = $presetPath;
28 5
        $this->userName = $userName;
29 5
    }
30
31
    /**
32
     * @param string[] $path
33
     * @param string[] $module
34
     * @param bool $single
35
     * @return string
36
     */
37 5
    public function link(?array $path = null, array $module = [], bool $single = false): string
38
    {
39 5
        return $this->lib->link(
40 5
            is_null($path) ? $this->presetPath : $path,
41
            $module,
42
            $single,
43 5
            $this->userName
44
        );
45
    }
46
}
47