PHP Class Neomerx\JsonApi\Http\Responses

Inheritance: implements Neomerx\JsonApi\Contracts\Http\ResponsesInterface
显示文件 Open project: neomerx/json-api Class Usage Examples

Public Methods

Method Description
getCodeResponse ( $statusCode, array $headers = [] )
getContentResponse ( $data, $statusCode = self::HTTP_OK, $links = null, $meta = null, array $headers = [] )
getCreatedResponse ( $resource, $links = null, $meta = null, array $headers = [] )
getErrorResponse ( $errors, $statusCode = self::HTTP_BAD_REQUEST, array $headers = [] )
getIdentifiersResponse ( $data, $statusCode = self::HTTP_OK, $links = null, $meta = null, array $headers = [] )
getMetaResponse ( $meta, $statusCode = self::HTTP_OK, array $headers = [] )

Protected Methods

Method Description
createJsonApiResponse ( string | null $content, integer $statusCode, array $headers = [] ) : mixed
createResponse ( string | null $content, integer $statusCode, array $headers ) : mixed Create HTTP response.
getEncoder ( ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface
getEncodingParameters ( ) : Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface | null
getMediaType ( ) : Neomerx\JsonApi\Contracts\Http\Headers\MediaTypeInterface
getResourceLocationUrl ( mixed $resource ) : string
getSchemaContainer ( ) : Neomerx\JsonApi\Contracts\Schema\ContainerInterface
getSupportedExtensions ( ) : Neomerx\JsonApi\Contracts\Http\Headers\SupportedExtensionsInterface | null
getUrlPrefix ( ) : string | null

Method Details

createJsonApiResponse() protected method

protected createJsonApiResponse ( string | null $content, integer $statusCode, array $headers = [] ) : mixed
$content string | null
$statusCode integer
$headers array
return mixed

createResponse() abstract protected method

Create HTTP response.
abstract protected createResponse ( string | null $content, integer $statusCode, array $headers ) : mixed
$content string | null
$statusCode integer
$headers array
return mixed

getCodeResponse() public method

public getCodeResponse ( $statusCode, array $headers = [] )
$headers array

getContentResponse() public method

public getContentResponse ( $data, $statusCode = self::HTTP_OK, $links = null, $meta = null, array $headers = [] )
$headers array

getCreatedResponse() public method

public getCreatedResponse ( $resource, $links = null, $meta = null, array $headers = [] )
$headers array

getEncoder() abstract protected method

abstract protected getEncoder ( ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface
return Neomerx\JsonApi\Contracts\Encoder\EncoderInterface

getEncodingParameters() abstract protected method

abstract protected getEncodingParameters ( ) : Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface | null
return Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface | null

getErrorResponse() public method

public getErrorResponse ( $errors, $statusCode = self::HTTP_BAD_REQUEST, array $headers = [] )
$headers array

getIdentifiersResponse() public method

public getIdentifiersResponse ( $data, $statusCode = self::HTTP_OK, $links = null, $meta = null, array $headers = [] )
$headers array

getMediaType() abstract protected method

abstract protected getMediaType ( ) : Neomerx\JsonApi\Contracts\Http\Headers\MediaTypeInterface
return Neomerx\JsonApi\Contracts\Http\Headers\MediaTypeInterface

getMetaResponse() public method

public getMetaResponse ( $meta, $statusCode = self::HTTP_OK, array $headers = [] )
$headers array

getResourceLocationUrl() protected method

protected getResourceLocationUrl ( mixed $resource ) : string
$resource mixed
return string

getSchemaContainer() abstract protected method

abstract protected getSchemaContainer ( ) : Neomerx\JsonApi\Contracts\Schema\ContainerInterface
return Neomerx\JsonApi\Contracts\Schema\ContainerInterface

getSupportedExtensions() abstract protected method

abstract protected getSupportedExtensions ( ) : Neomerx\JsonApi\Contracts\Http\Headers\SupportedExtensionsInterface | null
return Neomerx\JsonApi\Contracts\Http\Headers\SupportedExtensionsInterface | null

getUrlPrefix() abstract protected method

abstract protected getUrlPrefix ( ) : string | null
return string | null