Class Response
A response to a HTTP request.
- ICanBoogie\HTTP\Response uses ICanBoogie\Accessor\AccessorTrait (not available)
Direct known subclasses
ICanBoogie\HTTP\FileResponse
,
ICanBoogie\HTTP\RedirectResponse
Methods summary
public
__construct( mixed $body
= null, integer|ICanBoogie\HTTP\Status
$status
= Status::OK, ICanBoogie\HTTP\Headers
|array $headers
= [] )
Initializes the $body, $header, $date and $status properties.
protected
set_status( integer|ICanBoogie\HTTP\Status
$status
)
Sets response status code and optionally status message.
protected
get_content_type( void )
: ICanBoogie\HTTP\Headers\ContentType
Returns the value of the Content-Type
header field.
protected
get_content_length( void )
: integer
Returns the value of the Content-Length
header field.
protected
get_date( void )
: ICanBoogie\HTTP\Headers\Date
Returns the value of the Date
header field.
protected
get_last_modified( void )
: ICanBoogie\HTTP\Headers\Date
Returns the value of the Last-Modified
header field.
protected
get_expires( void )
: ICanBoogie\HTTP\Headers\Date
Returns the value of the Expires
header field.
protected
set_cache_control( string $cache_directives
)
Sets the directives of the Cache-Control
header field.
protected
get_cache_control( void )
: ICanBoogie\HTTP\Headers\CacheControl
Returns the Cache-Control
header field.
protected
get_is_validateable( void )
: boolean
Checks that the response includes header fields that can be used to validate the response with the origin server using a conditional GET request.
Properties summary
Magic properties
public
$ttl
: integer
Adjusts the s-maxage
part of the Cache-Control
header field definition according to the Age
header field definition.
public
$cache_control
: ICanBoogie\HTTP\Headers\CacheControl
Shortcut to the Cache-Control
header field definition.
public
$content_type
: ICanBoogie\HTTP\Headers\ContentType
Shortcut to the Content-Type
header field definition.
public
$last_modified
: ICanBoogie\HTTP\Headers\Date
Shortcut to the Last-Modified
header field definition.