Skip to content

Latest commit

 

History

History
262 lines (187 loc) · 4.51 KB

HttpResponse.ru.md

File metadata and controls

262 lines (187 loc) · 4.51 KB

HttpResponse

  • класс HttpResponse (httpclient\HttpResponse)
  • исходники httpclient/HttpResponse.php

Описание

Class HttpResponse


Свойства


Методы


Методы

__construct()

__construct(): void

HttpResponse constructor.


body()

body(mixed $data): mixed|string|array|Stream

statusCode()

statusCode([ int $responseCode): int

statusMessage()

statusMessage([ string $statusMessage): string

headers()

headers([ array $headerFields): array

header()

header(string $name): mixed

Returns header value.


contentType()

contentType([ string $contentType): string

Returns Content-Type header value.


contentLength()

contentLength([ int $size): int

Content-Length header value, returns -1 if it does not exist.


cookie()

cookie(string $name): string|array

cookies()

cookies(array $data): array

Return array of Set-Cookie header.


isSuccess()

isSuccess(): bool

Check http code >= 200 and <= 399


isFail()

isFail(): bool

Check http code >= 400


isError()

isError(): bool

Check http code >= 400


isBadRequest()

isBadRequest(): bool

Check http code is 400.


isAuthRequired()

isAuthRequired(): bool

Check http code is 401.


isPaymentRequired()

isPaymentRequired(): bool

Check http code is 402.


isNotFound()

isNotFound(): bool

Check http code is 404


isAccessDenied()

isAccessDenied(): bool

Check http code is 403


isInvalidMethod()

isInvalidMethod(): bool

Check http code is 405


isServerError()

isServerError(): bool

Check http code >= 500


isServiceUnavailable()

isServiceUnavailable(): bool

Check http code is 503.


time()

time(): php\time\Time

Time of creation response.