PHP Класс Larabros\Elogram\Http\Response

Автор: Hassan Khan ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$data array
$meta array
$pagination array
$raw array

Открытые методы

Метод Описание
__construct ( array $meta = [], array $data = [], array $pagination = [] ) Creates a new instance of :php:class:Response.
__toString ( ) : string Returns the JSON-encoded raw response.
createFromJson ( array $response ) : static Creates a new instance of :php:class:Response from a JSON-decoded response body.
get ( ) : array | Collection Gets the response body. If the response contains multiple records, a Collection is returned.
getRaw ( string | null $key = null ) : array Gets the JSON-decoded raw response.
hasPages ( ) : boolean If the response has a pagination field with a next_url key, then returns true, otherwise false.
merge ( Response $response ) : Response Merges the contents of this response with $response and returns a new :php:class:Response instance.
nextUrl ( ) : string | null Returns the next URL, if available, otherwise null.

Защищенные методы

Метод Описание
isCollection ( array | Collection $data ) : boolean Tests the current response data to see if one or more records were returned.
isRecord ( array | Collection $data ) : boolean Tests the current response data to see if a single record was returned.

Описание методов

__construct() публичный Метод

Creates a new instance of :php:class:Response.
public __construct ( array $meta = [], array $data = [], array $pagination = [] )
$meta array
$data array
$pagination array

__toString() публичный Метод

Returns the JSON-encoded raw response.
public __toString ( ) : string
Результат string

createFromJson() публичный статический Метод

Creates a new instance of :php:class:Response from a JSON-decoded response body.
public static createFromJson ( array $response ) : static
$response array
Результат static

get() публичный Метод

Gets the response body. If the response contains multiple records, a Collection is returned.
public get ( ) : array | Collection
Результат array | Illuminate\Support\Collection

getRaw() публичный Метод

Gets the JSON-decoded raw response.
public getRaw ( string | null $key = null ) : array
$key string | null
Результат array

hasPages() публичный Метод

If the response has a pagination field with a next_url key, then returns true, otherwise false.
public hasPages ( ) : boolean
Результат boolean

isCollection() защищенный Метод

Tests the current response data to see if one or more records were returned.
protected isCollection ( array | Collection $data ) : boolean
$data array | Illuminate\Support\Collection
Результат boolean

isRecord() защищенный Метод

Tests the current response data to see if a single record was returned.
protected isRecord ( array | Collection $data ) : boolean
$data array | Illuminate\Support\Collection
Результат boolean

merge() публичный Метод

Merges the contents of this response with $response and returns a new :php:class:Response instance.
public merge ( Response $response ) : Response
$response Response
Результат Response

nextUrl() публичный Метод

Returns the next URL, if available, otherwise null.
public nextUrl ( ) : string | null
Результат string | null

Описание свойств

$data защищенное свойство

protected array $data
Результат array

$meta защищенное свойство

protected array $meta
Результат array

$pagination защищенное свойство

protected array $pagination
Результат array

$raw защищенное свойство

protected array $raw
Результат array