Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Cache / Context / TimeZoneCacheContext.php
1 <?php
2
3 namespace Drupal\Core\Cache\Context;
4
5 use Drupal\Core\Cache\CacheableMetadata;
6
7 /**
8  * Defines the TimeZoneCacheContext service, for "per time zone" caching.
9  *
10  * Cache context ID: 'timezone'.
11  *
12  * @see \Drupal\Core\Session\AccountProxy::setAccount()
13  */
14 class TimeZoneCacheContext implements CacheContextInterface {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static function getLabel() {
20     return t("Time zone");
21   }
22
23   /**
24    * {@inheritdoc}
25    */
26   public function getContext() {
27     // date_default_timezone_set() is called in AccountProxy::setAccount(), so
28     // we can safely retrieve the timezone.
29     return date_default_timezone_get();
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   public function getCacheableMetadata() {
36     return new CacheableMetadata();
37   }
38
39 }