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 |
||
36 | 4 | public function getUrl($path) |
|
37 | { |
||
38 | 4 | $regExp = '/\/\/|https?:/i'; |
|
39 | 4 | if (preg_match($regExp, $path)) { |
|
40 | 2 | return $path; |
|
41 | } |
||
42 | try { |
||
43 | 2 | $generated = call_user_func_array( |
|
44 | 2 | [$this->getRouterGenerator(), 'generate'], |
|
45 | 1 | func_get_args() |
|
46 | 1 | ); |
|
47 | 1 | } catch (AuraException $caught) { |
|
48 | $generated = false; |
||
49 | } |
||
50 | |||
51 | 2 | $basePath = rtrim($this->getRequest()->getBasePath(), '/'); |
|
52 | 1 | $path = $generated |
|
53 | 1 | ? $generated |
|
54 | 2 | : "{$basePath}/{$path}"; |
|
55 | |||
56 | 2 | return $path; |
|
57 | } |
||
58 | |||
70 | } |