PHP 클래스 Larabros\Elogram\Http\Response

저자: Hassan Khan ([email protected])
파일 보기 프로젝트 열기: larabros/elogram 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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