Ouzo\Utilities\Clock::now PHP Метод

now() публичный статический Метод

Obtains a Clock set to the current time.
public static now ( ) : Clock
Результат Clock
    public static function now()
    {
        $date = new DateTime();
        if (self::$freeze) {
            $date->setTimestamp(self::$freezeDate->getTimestamp());
        }
        return new Clock($date);
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function get()
 {
     $function = $this->function;
     $now = Clock::now()->getTimestamp();
     if ($this->cachedResult === null || $now - $this->lastCallTime > $this->expireTime) {
         $this->cachedResult = $function();
         $this->lastCallTime = $now;
     }
     return $this->cachedResult;
 }
All Usage Examples Of Ouzo\Utilities\Clock::now