| Total Complexity | 18 |
| Total Lines | 96 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class MockUri implements UriInterface |
||
| 8 | { |
||
| 9 | private string $scheme; |
||
| 10 | private string $host; |
||
| 11 | private string $path; |
||
| 12 | private string $query; |
||
| 13 | |||
| 14 | public function __construct(string $url) |
||
| 15 | { |
||
| 16 | $p = parse_url($url); |
||
| 17 | $this->scheme = $p['scheme'] ?? ''; |
||
| 18 | $this->host = $p['host'] ?? ''; |
||
| 19 | $this->path = $p['path'] ?? ''; |
||
| 20 | $this->query = $p['query'] ?? ''; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getScheme() |
||
| 24 | { |
||
| 25 | return $this->scheme; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getHost() |
||
| 29 | { |
||
| 30 | return $this->host; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function getPath() |
||
| 34 | { |
||
| 35 | return $this->path; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getQuery() |
||
| 39 | { |
||
| 40 | return $this->query; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getPort() |
||
| 44 | { |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getAuthority() |
||
| 48 | { |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getUserInfo() |
||
| 52 | { |
||
| 53 | } |
||
| 54 | |||
| 55 | public function getFragment() |
||
| 56 | { |
||
| 57 | } |
||
| 58 | |||
| 59 | public function withPath($path) |
||
| 60 | { |
||
| 61 | return $this; |
||
| 62 | } |
||
| 63 | |||
| 64 | public function withScheme($scheme) |
||
| 65 | { |
||
| 66 | return $this; |
||
| 67 | } |
||
| 68 | |||
| 69 | public function withUserInfo($user, $password = null) |
||
| 70 | { |
||
| 71 | return $this; |
||
| 72 | } |
||
| 73 | |||
| 74 | public function withHost($host) |
||
| 75 | { |
||
| 76 | return $this; |
||
| 77 | } |
||
| 78 | |||
| 79 | public function withPort($port) |
||
| 80 | { |
||
| 81 | return $this; |
||
| 82 | } |
||
| 83 | |||
| 84 | public function withQuery($query) |
||
| 85 | { |
||
| 86 | return $this; |
||
| 87 | } |
||
| 88 | |||
| 89 | public function withFragment($fragment) |
||
| 92 | } |
||
| 93 | |||
| 94 | public function __toString() |
||
| 95 | { |
||
| 96 | $query = $this->getQuery(); |
||
| 97 | return sprintf( |
||
| 98 | '%s://%s%s%s', |
||
| 99 | $this->getScheme(), |
||
| 103 | ); |
||
| 104 | } |
||
| 105 | } |
||
| 106 |