UserCacheContextBase.php 686 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\Core\Cache\Context;
  3. use Drupal\Core\Session\AccountInterface;
  4. /**
  5. * Base class for user-based cache contexts.
  6. *
  7. * Subclasses need to implement either
  8. * \Drupal\Core\Cache\Context\CacheContextInterface or
  9. * \Drupal\Core\Cache\Context\CalculatedCacheContextInterface.
  10. */
  11. abstract class UserCacheContextBase {
  12. /**
  13. * The account object.
  14. *
  15. * @var \Drupal\Core\Session\AccountInterface
  16. */
  17. protected $user;
  18. /**
  19. * Constructs a new UserCacheContextBase class.
  20. *
  21. * @param \Drupal\Core\Session\AccountInterface $user
  22. * The current user.
  23. */
  24. public function __construct(AccountInterface $user) {
  25. $this->user = $user;
  26. }
  27. }