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

External::link()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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