PHP 클래스 Flugg\Responder\Http\ResponseBuilder

저자: Alexander Tømmerås ([email protected])
상속: implements Illuminate\Contracts\Support\Arrayable, implements Illuminate\Contracts\Support\Jsonable, implements JsonSerializabl\JsonSerializable
파일 보기 프로젝트 열기: flugger/laravel-responder 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$includeStatusCode boolean Flag indicating if status code should be added to the serialized data.
$responseFactory Illuminate\Contracts\Routing\ResponseFactory | Laravel\Lumen\Http\ResponseFactory Response factory used to generate JSON responses.
$statusCode integer The HTTP status code for the response.

공개 메소드들

메소드 설명
__construct ( Illuminate\Contracts\Routing\ResponseFactory | ResponseFactory $responseFactory ) Constructor.
jsonSerialize ( ) : array Convert the object into something JSON serializable.
respond ( integer $statusCode = null, array $headers = [] ) : Illuminate\Http\JsonResponse Serialize the data and wrap it in a JSON response object.
setIncludeStatusCode ( boolean $includeStatusCode ) : ResponseBuilder Set a flag indicating if status code should be added to the response.
setStatus ( integer $statusCode ) : ResponseBuilder Set the HTTP status code for the response.
toArray ( ) : array Convert the response to an array.
toCollection ( ) : Collection Convert the response to an Illuminate collection.
toJson ( integer $options ) : string Convert the response to JSON.

보호된 메소드들

메소드 설명
includeStatusCode ( array $data ) : array Include a status code to the serialized data if enabled.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( Illuminate\Contracts\Routing\ResponseFactory | ResponseFactory $responseFactory )
$responseFactory Illuminate\Contracts\Routing\ResponseFactory | Laravel\Lumen\Http\ResponseFactory

includeStatusCode() 보호된 메소드

Include a status code to the serialized data if enabled.
protected includeStatusCode ( array $data ) : array
$data array
리턴 array

jsonSerialize() 공개 메소드

Convert the object into something JSON serializable.
public jsonSerialize ( ) : array
리턴 array

respond() 공개 메소드

Serialize the data and wrap it in a JSON response object.
public respond ( integer $statusCode = null, array $headers = [] ) : Illuminate\Http\JsonResponse
$statusCode integer
$headers array
리턴 Illuminate\Http\JsonResponse

setIncludeStatusCode() 공개 메소드

Set a flag indicating if status code should be added to the response.
public setIncludeStatusCode ( boolean $includeStatusCode ) : ResponseBuilder
$includeStatusCode boolean
리턴 ResponseBuilder

setStatus() 공개 메소드

Set the HTTP status code for the response.
public setStatus ( integer $statusCode ) : ResponseBuilder
$statusCode integer
리턴 ResponseBuilder

toArray() 추상적인 공개 메소드

Convert the response to an array.
abstract public toArray ( ) : array
리턴 array

toCollection() 공개 메소드

Convert the response to an Illuminate collection.
public toCollection ( ) : Collection
리턴 Illuminate\Support\Collection

toJson() 공개 메소드

Convert the response to JSON.
public toJson ( integer $options ) : string
$options integer
리턴 string

프로퍼티 상세

$includeStatusCode 보호되어 있는 프로퍼티

Flag indicating if status code should be added to the serialized data.
protected bool $includeStatusCode
리턴 boolean

$responseFactory 보호되어 있는 프로퍼티

Response factory used to generate JSON responses.
protected ResponseFactory,Illuminate\Contracts\Routing|ResponseFactory,Laravel\Lumen\Http $responseFactory
리턴 Illuminate\Contracts\Routing\ResponseFactory | Laravel\Lumen\Http\ResponseFactory

$statusCode 보호되어 있는 프로퍼티

The HTTP status code for the response.
protected int $statusCode
리턴 integer