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