| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 106 | public function withUri(UriInterface $uri, $preserveHost = false) |
||
| 107 | { |
||
| 108 | if ($uri === $this->uri) { |
||
| 109 | return $this; |
||
| 110 | } |
||
| 111 | |||
| 112 | $clone = clone $this; |
||
| 113 | $clone->uri = $uri; |
||
| 114 | |||
| 115 | if ($preserveHost) { |
||
| 116 | if (!$clone->hasHeader('host')) { |
||
| 117 | $clone->headers['host'] = 'Host'; |
||
|
1 ignored issue
–
show
|
|||
| 118 | $clone->headers['Host'] = [$uri->getHost()]; |
||
| 119 | } |
||
| 120 | } |
||
| 121 | |||
| 122 | return $clone; |
||
| 123 | } |
||
| 125 |