Conditions | 5 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function __invoke(string $alpsFile, string $href): string |
||
19 | { |
||
20 | if (file_exists($href)) { |
||
21 | return $href; |
||
22 | } |
||
23 | |||
24 | if (substr($href, 0, 4) === 'http') { |
||
25 | return $href; |
||
26 | } |
||
27 | |||
28 | if (substr($href, 0, 1) === '#') { |
||
29 | return sprintf('%s%s', $alpsFile, $href); |
||
30 | } |
||
31 | |||
32 | [$file] = explode('#', $href); |
||
33 | if (file_exists($file)) { |
||
34 | return $href; |
||
35 | } |
||
36 | |||
37 | $dirName = $this->getDirname($alpsFile); |
||
38 | |||
39 | return sprintf('%s/%s', $dirName, $href); |
||
40 | } |
||
56 |