| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function createRequest($options) |
||
| 31 | { |
||
| 32 | if (!$options instanceof DiscoverOptions) { |
||
| 33 | throw new \RuntimeException('Options must be instance of ' . DiscoverOptions::class); |
||
| 34 | } |
||
| 35 | |||
| 36 | $request = new SearchRequest(); |
||
| 37 | return $request |
||
| 38 | ->withRequestTarget('*') |
||
| 39 | ->withProtocolVersion('1.1') |
||
| 40 | ->withHeader('HOST', (string)$request->getUri()) |
||
| 41 | ->withHeader('MAN', '"ssdp:discover"') |
||
| 42 | ->withHeader('MX', (string)$options->getMaximumWaitTime()) |
||
| 43 | ->withHeader('ST', (string)$options->getSearchTarget()); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |