class BazCacheContext
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\BazCacheContext
- 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\BazCacheContext
- 10 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\BazCacheContext
Fake calculated cache context class.
Hierarchy
- class \Drupal\Tests\Core\Cache\Context\BazCacheContext implements \Drupal\Core\Cache\Context\CalculatedCacheContextInterface
Expanded class hierarchy of BazCacheContext
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ CacheContextsManagerTest.php, line 279
Namespace
Drupal\Tests\Core\Cache\ContextView source
class BazCacheContext implements CalculatedCacheContextInterface {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return 'Baz';
}
/**
* {@inheritdoc}
*/
public function getContext($parameter = NULL) {
if (!is_string($parameter) || strlen($parameter) === 0) {
throw new \Exception();
}
return str_rot13($parameter);
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($parameter = NULL) {
return new CacheableMetadata();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
BazCacheContext::getCacheableMetadata | public | function | Gets the cacheability metadata for the context based on the parameter value. | Overrides CalculatedCacheContextInterface::getCacheableMetadata |
BazCacheContext::getContext | public | function | Returns the string representation of the cache context. | Overrides CalculatedCacheContextInterface::getContext |
BazCacheContext::getLabel | public static | function | Returns the label of the cache context. | Overrides CalculatedCacheContextInterface::getLabel |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.