PHP Class LeagueWrap\Response

ファイルを表示 Open project: paquettg/leaguewrap Class Usage Examples

Protected Properties

Property Type Description
$code integer The HTTP code resulting from the request.
$content string The content of the response.
$headers array Request's headers.

Public Methods

Method Description
__construct ( string $content, integer $code, array $headers = [] ) The primary content of the response.
__toString ( ) : string Returns the content of the response as a string.
getCode ( ) : integer Returns the code associated with the response.
getHeader ( string $name ) : string | null Return header's value by key.
getHeaders ( ) : array Return array of header from response in format header key => header value.
hasHeader ( string $name ) : boolean Check if header key is present

Method Details

__construct() public method

The primary content of the response.
public __construct ( string $content, integer $code, array $headers = [] )
$content string
$code integer
$headers array

__toString() public method

Returns the content of the response as a string.
public __toString ( ) : string
return string

getCode() public method

Returns the code associated with the response.
public getCode ( ) : integer
return integer

getHeader() public method

If the header is not present, return null.
public getHeader ( string $name ) : string | null
$name string
return string | null

getHeaders() public method

Only one value per header key is allowed.
public getHeaders ( ) : array
return array

hasHeader() public method

Check if header key is present
public hasHeader ( string $name ) : boolean
$name string
return boolean

Property Details

$code protected_oe property

The HTTP code resulting from the request.
protected int $code
return integer

$content protected_oe property

The content of the response.
protected string $content
return string

$headers protected_oe property

Request's headers.
protected array $headers
return array