Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
17 | public function createUri(string $uri = ''): UriInterface |
||
18 | { |
||
19 | if (empty($uri)) { |
||
20 | if (!isset($_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI'])) { |
||
21 | throw new \RuntimeException('Can not create Uri'); |
||
22 | } |
||
23 | |||
24 | $uri .= $this->getScheme() . '://' . $_SERVER['SERVER_NAME'] . ''; |
||
25 | $uri .= empty($_SERVER['SERVER_PORT']) ? '' : ':' . $_SERVER['SERVER_PORT']; |
||
26 | $uri .= $_SERVER['REQUEST_URI'] ?? ''; |
||
27 | } |
||
28 | |||
29 | return new Uri($uri); |
||
30 | } |
||
40 |