setDeltaSeconds($deltaSeconds); } } /** * Get header name * * @return string */ public function getFieldName() { return 'Age'; } /** * Get header value (number of seconds) * * @return int */ public function getFieldValue() { return $this->getDeltaSeconds(); } /** * Set number of seconds * * @param int $delta * @return RetryAfter */ public function setDeltaSeconds($delta) { if (! is_int($delta) && ! is_numeric($delta)) { throw new Exception\InvalidArgumentException('Invalid delta provided'); } $this->deltaSeconds = (int) $delta; return $this; } /** * Get number of seconds * * @return int */ public function getDeltaSeconds() { return $this->deltaSeconds; } /** * Return header line * In case of overflow RFC states to set value of 2147483648 (2^31) * * @return string */ public function toString() { return 'Age: ' . (($this->deltaSeconds >= PHP_INT_MAX) ? '2147483648' : $this->deltaSeconds); } }