class ChainResponsePolicy implements ChainResponsePolicyInterface (View source)

Implements a compound response policy.

When evaluating the compound policy, all of the contained rules are applied to the response. The overall result is computed according to the following rules:

  1. Returns static::DENY if any of the rules evaluated to static::DENY
  2. Otherwise returns NULL

Properties

protected ResponsePolicyInterface[] $rules

A list of policy rules to apply when this policy is checked.

Methods

string|null
check(Response $response, Request $request)

Determines whether it is save to store a page in the cache.

$this
addPolicy(ResponsePolicyInterface $policy)

Add a policy to the list of policy rules.

Details

string|null check(Response $response, Request $request)

Determines whether it is save to store a page in the cache.

Parameters

Response $response

The response which is about to be sent to the client.

Request $request

The request object.

Return Value

string|null

Either static::DENY or NULL. Calling code may attempt to store a page in the cache unless static::DENY is returned. Returns NULL if the policy policy is not specified for the given response.

$this addPolicy(ResponsePolicyInterface $policy)

Add a policy to the list of policy rules.

Parameters

ResponsePolicyInterface $policy

The request policy rule to add.

Return Value

$this