| 1 | <?php |
||
| 5 | class HttpClient |
||
| 6 | { |
||
| 7 | /** @var Worker */ |
||
| 8 | private $worker; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param Worker $worker |
||
| 12 | */ |
||
| 13 | public function __construct(Worker $worker) |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @return Worker |
||
| 20 | */ |
||
| 21 | public function getWorker(): Worker |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return array|null Request information as ['ctx'=>[], 'body'=>string] or null if termination request or invalid context. |
||
| 28 | */ |
||
| 29 | public function acceptRequest() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Send response to the application server. |
||
| 47 | * |
||
| 48 | * @param int $status Http status code |
||
| 49 | * @param string $body Body of response |
||
| 50 | * @param string[][] $headers An associative array of the message's headers. Each |
||
| 51 | * key MUST be a header name, and each value MUST be an array of strings |
||
| 52 | * for that header. |
||
| 53 | */ |
||
| 54 | public function respond($status, $body, $headers = []) |
||
| 66 | } |
||
| 67 |