External   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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
    protected Link $lib;
13
    /** @var string[] */
14
    protected array $presetPath = [];
15
    protected ?string $userName = null;
16
17
    /**
18
     * @param Link $lib
19
     * @param string[] $presetPath
20
     * @param string|null $userName
21
     */
22 5
    public function __construct(Link $lib, array $presetPath, ?string $userName = null)
23
    {
24 5
        $this->lib = $lib;
25 5
        $this->presetPath = $presetPath;
26 5
        $this->userName = $userName;
27 5
    }
28
29
    /**
30
     * @param string[] $path
31
     * @param string[] $module
32
     * @param bool $single
33
     * @return string
34
     */
35 5
    public function link(?array $path = null, array $module = [], bool $single = false): string
36
    {
37 5
        return $this->lib->link(
38 5
            is_null($path) ? $this->presetPath : $path,
39
            $module,
40
            $single,
41 5
            $this->userName
42
        );
43
    }
44
}
45