Response
About 1 min
Response
- Full name:
\Hazaar\HTTP\Response
Properties
status
public ?int $status
name
public string $name
version
public string $version
body
The actual body of the response.
public string[]|string $body
contentLength
public int $contentLength
bytesRemaining
public int $bytesRemaining
headers
public array<string,string[]|string> $headers
buffer
private ?string $buffer
headersParsed
private bool $headersParsed
chunked
private bool $chunked
chunkOffset
private int $chunkOffset
Methods
__construct
public __construct(?int $status = null, array<string,string[]|string> $headers = [], string $version = 'HTTP/1.1'): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$status | ?int | |
$headers | array<string,string[]|string> | |
$version | string |
__get
Magic method to allow access to headers as properties.
public __get(string $key): null|string[]|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | The header key to get |
setStatus
public setStatus(int $status): void
Parameters:
Parameter | Type | Description |
---|---|---|
$status | int |
write
public write(string $string): void
Parameters:
Parameter | Type | Description |
---|---|---|
$string | string |
read
public read(string $buffer): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$buffer | string |
hasHeader
public hasHeader(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
getHeader
Get a header from the response.
public getHeader(string $header): null|string[]|string
Parameters:
Parameter | Type | Description |
---|---|---|
$header | string | The header key to get |
setHeader
public setHeader(string $header, ?string $content = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$header | string | |
$content | ?string |
size
public size(): int
toString
public toString(): string
getStatusMessage
public getStatusMessage(?int $code = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$code | ?int |
getContentType
Get the content type of the response.
public getContentType(array<string,string>& $args = []): string
This method will return the content type of the response and optionally return any arguments that were
Parameters:
Parameter | Type | Description |
---|---|---|
$args | array<string,string> | The arguments of the content type header will be returned in this array |
body
public body(bool $raw = false): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$raw | bool |
decrypt
public decrypt(string $key, ?string $cipher = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$cipher | ?string |
Automatically generated on 2024-11-14