You are here

public function AuthcacheP13nTestEchoFragmentValidator::validate in Authenticated User Page Caching (Authcache) 7.2

Validate the given list of keys.

Throw AuthcacheP13nRequestInvalidInput to abort a request.

Note: At the time this method is called, the bootstrap phase is not guaranteed to be greater than DRUPAL_BOOTSTRAP_SESSION. Therefore avoid calling functions which will trigger hook invocations like e.g. entity_load.

Parameters

array $keys: An associative array of key-value pairs (key=value) representing the keys of the fragment(s) to load.

Return value

array An associative array of key-value pairs where keys correspond to the input keys and the values to subjects to be used in the renderer.

Throws

AuthcacheP13nRequestInvalidInput

Overrides AuthcacheP13nFragmentValidatorInterface::validate

File

modules/authcache_p13n/tests/authcache_p13n.stub.inc, line 437
Stub classes for testing.

Class

AuthcacheP13nTestEchoFragmentValidator
Stub class for fragment request validator.

Code

public function validate($keys) {
  $valid = !isset($keys['invalid']);
  if (!$valid) {
    throw new AuthcacheP13nRequestInvalidInput();
  }
  return $keys;
}