Conditions | 5 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function generateAbsoluteUrl($path) |
||
29 | { |
||
30 | if ($this->isNetworkPath($path)) { |
||
31 | return $path; |
||
32 | } |
||
33 | |||
34 | $uri = $this->request->getUri(); |
||
35 | |||
36 | $host = $uri->getHost(); |
||
37 | if ('' === $host) { |
||
38 | return $path; |
||
39 | } |
||
40 | |||
41 | if (null !== $uri->getPort()) { |
||
42 | $host .= ':'.$uri->getPort(); |
||
43 | } |
||
44 | |||
45 | if (! $this->hasLeadingSlash($path)) { |
||
46 | $path = rtrim($uri->getPath(), '/').'/'.$path; |
||
47 | } |
||
48 | |||
49 | return $uri->getScheme().'://'.$host.$path; |
||
50 | } |
||
51 | |||
70 |