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