function ChainResponsePolicy::check

Same name in this branch
  1. 10 core/lib/Drupal/Core/ProxyClass/PageCache/ChainResponsePolicy.php \Drupal\Core\ProxyClass\PageCache\ChainResponsePolicy::check()
Same name in other branches
  1. 9 core/lib/Drupal/Core/ProxyClass/PageCache/ChainResponsePolicy.php \Drupal\Core\ProxyClass\PageCache\ChainResponsePolicy::check()
  2. 9 core/lib/Drupal/Core/PageCache/ChainResponsePolicy.php \Drupal\Core\PageCache\ChainResponsePolicy::check()
  3. 8.9.x core/lib/Drupal/Core/ProxyClass/PageCache/ChainResponsePolicy.php \Drupal\Core\ProxyClass\PageCache\ChainResponsePolicy::check()
  4. 8.9.x core/lib/Drupal/Core/PageCache/ChainResponsePolicy.php \Drupal\Core\PageCache\ChainResponsePolicy::check()
  5. 11.x core/lib/Drupal/Core/ProxyClass/PageCache/ChainResponsePolicy.php \Drupal\Core\ProxyClass\PageCache\ChainResponsePolicy::check()
  6. 11.x core/lib/Drupal/Core/PageCache/ChainResponsePolicy.php \Drupal\Core\PageCache\ChainResponsePolicy::check()

File

core/lib/Drupal/Core/PageCache/ChainResponsePolicy.php, line 32

Class

ChainResponsePolicy
Implements a compound response policy.

Namespace

Drupal\Core\PageCache

Code

public function check(Response $response, Request $request) {
    foreach ($this->rules as $rule) {
        $result = $rule->check($response, $request);
        if ($result === static::DENY) {
            return $result;
        }
        elseif (isset($result)) {
            throw new \UnexpectedValueException('Return value of ResponsePolicyInterface::check() must be one of ResponsePolicyInterface::DENY or NULL');
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.