3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Mail\Header
;
13 * @todo Add accessors for setting date from DateTime, Zend\Date, or a string
15 class Date
implements HeaderInterface
22 public static function fromString($headerLine)
24 list($name, $value) = GenericHeader
::splitHeaderLine($headerLine);
26 // check to ensure proper header type for this factory
27 if (strtolower($name) !== 'date') {
28 throw new Exception\
InvalidArgumentException('Invalid header line for Date string');
31 $header = new static($value);
36 public function __construct($value)
38 $this->value
= $value;
41 public function getFieldName()
46 public function getFieldValue($format = HeaderInterface
::FORMAT_RAW
)
51 public function setEncoding($encoding)
53 // This header must be always in US-ASCII
57 public function getEncoding()
62 public function toString()
64 return 'Date: ' . $this->getFieldValue();