/** * Get the time things should be cached for in seconds. * * @return int */ public function getCacheDuration() { if (!isset($this->_cacheDuration)) { $duration = $this->get('cacheDuration'); if ($duration) { $interval = new DateInterval($duration); $this->_cacheDuration = $interval->toSeconds(); } else { $this->_cacheDuration = 0; } } return $this->_cacheDuration; }
/** * Takes a PHP time format string and converts it to seconds. * {@see http://www.php.net/manual/en/datetime.formats.time.php} * * @param $timeFormatString * * @return string */ public static function timeFormatToSeconds($timeFormatString) { $interval = new DateInterval($timeFormatString); return $interval->toSeconds(); }