PHP Class Raml\Response

See also: http://raml.org/spec.html#responses
Inheritance: implements raml\ArrayInstantiationInterface, implements raml\MessageSchemaInterface
Exibir arquivo Open project: alecsammon/php-raml-parser Class Usage Examples

Public Methods

Method Description
__construct ( integer $statusCode ) Create a new Response
addBody ( raml\BodyInterface $body ) Add a new body
addHeader ( raml\NamedParameter $header ) Add a new header
createFromArray ( string $statusCode, array $data = [] ) : Response Create a new response object from an array
getBodies ( ) : raml\BodyInterface[] Returns the list of bodies for this response type.
getBodyByType ( string $type ) : raml\BodyInterface Get the body by type
getDescription ( ) : string Returns the description
getHeaders ( ) : raml\NamedParameter[] Returns the headers
getStatusCode ( ) : integer Returns the status code
getTypes ( ) : array Returns all supported types in response
setDescription ( string $description ) Set the description

Method Details

__construct() public method

Create a new Response
public __construct ( integer $statusCode )
$statusCode integer

addBody() public method

Add a new body
public addBody ( raml\BodyInterface $body )
$body raml\BodyInterface

addHeader() public method

Add a new header
public addHeader ( raml\NamedParameter $header )
$header raml\NamedParameter

createFromArray() public static method

Create a new response object from an array
public static createFromArray ( string $statusCode, array $data = [] ) : Response
$statusCode string
$data array
return Response

getBodies() public method

Returns the list of bodies for this response type.
public getBodies ( ) : raml\BodyInterface[]
return raml\BodyInterface[]

getBodyByType() public method

Get the body by type
public getBodyByType ( string $type ) : raml\BodyInterface
$type string
return raml\BodyInterface

getDescription() public method

Returns the description
public getDescription ( ) : string
return string

getHeaders() public method

Returns the headers
public getHeaders ( ) : raml\NamedParameter[]
return raml\NamedParameter[]

getStatusCode() public method

Returns the status code
public getStatusCode ( ) : integer
return integer

getTypes() public method

Returns all supported types in response
public getTypes ( ) : array
return array

setDescription() public method

Set the description
public setDescription ( string $description )
$description string