| Conditions | 4 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4.0058 |
| 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 | 2 | func_get_args() |
|
| 40 | 2 | ); |
|
| 41 | 2 | } catch (AuraException $caught) { |
|
| 42 | $generated = false; |
||
| 43 | } |
||
| 44 | |||
| 45 | 2 | $basePath = rtrim($this->getRequest()->getBasePath(), '/'); |
|
| 46 | $path = $generated |
||
| 47 | 2 | ? $generated |
|
| 48 | 2 | : "{$basePath}/{$path}"; |
|
| 49 | |||
| 50 | 2 | return $path; |
|
| 51 | } |
||
| 52 | |||
| 64 | } |