AbstractSurrogate
in package
implements
SurrogateInterface
Abstract class implementing Surrogate capabilities to Request and Response instances.
Tags
Interfaces, Classes and Traits
Table of Contents
- $contentTypes : mixed
- $phpEscapeMap : mixed
- __construct() : mixed
- addSurrogateCapability() : mixed
- Adds Surrogate-capability to the given Request.
- createCacheStrategy() : ResponseCacheStrategyInterface
- Returns a new cache strategy instance.
- handle() : string
- Handles a Surrogate from the cache.
- hasSurrogateCapability() : bool
- Checks that at least one surrogate has Surrogate capability.
- needsParsing() : bool
- Checks that the Response needs to be parsed for Surrogate tags.
- generateBodyEvalBoundary() : string
- removeFromControl() : mixed
- Remove the Surrogate from the Surrogate-Control header.
Properties
$contentTypes
protected
mixed
$contentTypes
$phpEscapeMap
protected
mixed
$phpEscapeMap
= [['<?', '<%', '<s', '<S'], ['<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>']]
Methods
__construct()
public
__construct([array<string|int, mixed> $contentTypes = ['text/html', 'text/xml', 'application/xhtml+xml', 'application/xml'] ]) : mixed
Parameters
- $contentTypes : array<string|int, mixed> = ['text/html', 'text/xml', 'application/xhtml+xml', 'application/xml']
-
An array of content-type that should be parsed for Surrogate information (default: text/html, text/xml, application/xhtml+xml, and application/xml)
Return values
mixed —addSurrogateCapability()
Adds Surrogate-capability to the given Request.
public
addSurrogateCapability(Request $request) : mixed
Parameters
- $request : Request
Return values
mixed —createCacheStrategy()
Returns a new cache strategy instance.
public
createCacheStrategy() : ResponseCacheStrategyInterface
Return values
ResponseCacheStrategyInterface —handle()
Handles a Surrogate from the cache.
public
handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors) : string
Parameters
- $cache : HttpCache
- $uri : string
- $alt : string
-
An alternative URI
- $ignoreErrors : bool
Return values
string —hasSurrogateCapability()
Checks that at least one surrogate has Surrogate capability.
public
hasSurrogateCapability(Request $request) : bool
Parameters
- $request : Request
Return values
bool —needsParsing()
Checks that the Response needs to be parsed for Surrogate tags.
public
needsParsing(Response $response) : bool
Parameters
- $response : Response
Return values
bool —generateBodyEvalBoundary()
protected
static generateBodyEvalBoundary() : string
Return values
string —removeFromControl()
Remove the Surrogate from the Surrogate-Control header.
protected
removeFromControl(Response $response) : mixed
Parameters
- $response : Response