Conditions | 4 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4.0047 |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
30 | 4 | public function getUrl($path) |
|
31 | { |
||
32 | 4 | $regExp = '/\/\/|https?:/i'; |
|
33 | 4 | if (preg_match($regExp, $path)) { |
|
34 | 2 | return $path; |
|
35 | } |
||
36 | try { |
||
37 | 2 | $generated = call_user_func_array( |
|
38 | 2 | [$this->getRouterGenerator(), 'generate'], |
|
39 | 1 | func_get_args() |
|
40 | 1 | ); |
|
41 | 1 | } catch (AuraException $caught) { |
|
42 | $generated = false; |
||
43 | } |
||
44 | |||
45 | 2 | $basePath = rtrim($this->getRequest()->getBasePath(), '/'); |
|
46 | 1 | $path = $generated |
|
47 | 1 | ? $generated |
|
48 | 2 | : "{$basePath}/{$path}"; |
|
49 | |||
50 | 2 | return $path; |
|
51 | } |
||
52 | |||
64 | } |