abstract class AbstractSurrogate implements SurrogateInterface

Abstract class implementing Surrogate capabilities to Request and Response instances.

Properties

protected $contentTypes
protected $phpEscapeMap

Methods

__construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml'))

No description

createCacheStrategy()

Returns a new cache strategy instance.

bool
hasSurrogateCapability(Request $request)

Checks that at least one surrogate has Surrogate capability.

addSurrogateCapability(Request $request)

Adds Surrogate-capability to the given Request.

bool
needsParsing(Response $response)

Checks that the Response needs to be parsed for Surrogate tags.

string
handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)

Handles a Surrogate from the cache.

removeFromControl(Response $response)

Remove the Surrogate from the Surrogate-Control header.

Details

at line 36
__construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml'))

Parameters

array $contentTypes An array of content-type that should be parsed for Surrogate information (default: text/html, text/xml, application/xhtml+xml, and application/xml)

at line 46
ResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

Return Value

ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance

at line 54
bool hasSurrogateCapability(Request $request)

Checks that at least one surrogate has Surrogate capability.

Parameters

Request $request

Return Value

bool true if one surrogate has Surrogate capability, false otherwise

at line 66
addSurrogateCapability(Request $request)

Adds Surrogate-capability to the given Request.

Parameters

Request $request

at line 77
bool needsParsing(Response $response)

Checks that the Response needs to be parsed for Surrogate tags.

Parameters

Response $response

Return Value

bool true if the Response needs to be parsed, false otherwise

at line 91
string handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)

Handles a Surrogate from the cache.

Parameters

HttpCache $cache An HttpCache instance
string $uri The main URI
string $alt An alternative URI
bool $ignoreErrors Whether to ignore errors or not

Return Value

string

Exceptions

RuntimeException
Exception

at line 117
protected removeFromControl(Response $response)

Remove the Surrogate from the Surrogate-Control header.

Parameters

Response $response