Source of file MimeVersion.php
Size: 1,994 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Mail/Header/MimeVersion.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Mail\Header; class MimeVersion implements HeaderInterface { /** * @var string Version string */ protected $version = '1.0'; public static function fromString($headerLine) { list($name, $value) = GenericHeader::splitHeaderLine($headerLine); // check to ensure proper header type for this factory if (strtolower($name) !== 'mime-version') { throw new Exception\InvalidArgumentException('Invalid header line for MIME-Version string'); } // Check for version, and set if found $header = new static(); if (preg_match('/^(?P<version>\d+\.\d+)$/', $value, $matches)) { $header->setVersion($matches['version']); } return $header; } public function getFieldName() { return 'MIME-Version'; } public function getFieldValue($format = HeaderInterface::FORMAT_RAW) { return $this->version; } public function setEncoding($encoding) { // This header must be always in US-ASCII return $this; } public function getEncoding() { return 'ASCII'; } public function toString() { return 'MIME-Version: ' . $this->getFieldValue(); } /** * Set the version string used in this header * * @param string $version * @return MimeVersion */ public function setVersion($version) { $this->version = $version; return $this; } /** * Retrieve the version string for this header * * @return string */ public function getVersion() { return $this->version; } } |