| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.2098 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 20 | public function createRequest(string $method, $uri): \Psr\Http\Message\RequestInterface |
|
| 18 | { |
||
| 19 | |||
| 20 | 20 | if (is_string($uri)) { |
|
| 21 | $uri = (new UriFactory())->createUri($uri); |
||
| 22 | } |
||
| 23 | |||
| 24 | 20 | if (!$uri instanceof \Psr\Http\Message\UriInterface) { |
|
|
|
|||
| 25 | throw new \InvalidArgumentException('URI must be a instance of ' . \Psr\Http\Message\UriInterface::class); |
||
| 26 | } |
||
| 27 | |||
| 28 | 20 | $body = (new StreamFactory())->createStream(''); |
|
| 29 | |||
| 30 | 20 | return new Request($method, $uri, [], $body); |
|
| 31 | } |
||
| 33 |