Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Mail / Header / MimeVersion.php
blob52474e4a4fe7e4d3d3778c562b15fec82b95623f
1 <?php
2 /**
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
8 */
10 namespace Zend\Mail\Header;
12 class MimeVersion implements HeaderInterface
14 /**
15 * @var string Version string
17 protected $version = '1.0';
19 public static function fromString($headerLine)
21 list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
23 // check to ensure proper header type for this factory
24 if (strtolower($name) !== 'mime-version') {
25 throw new Exception\InvalidArgumentException('Invalid header line for MIME-Version string');
28 // Check for version, and set if found
29 $header = new static();
30 if (preg_match('/^(?P<version>\d+\.\d+)$/', $value, $matches)) {
31 $header->setVersion($matches['version']);
34 return $header;
37 public function getFieldName()
39 return 'MIME-Version';
42 public function getFieldValue($format = HeaderInterface::FORMAT_RAW)
44 return $this->version;
47 public function setEncoding($encoding)
49 // This header must be always in US-ASCII
50 return $this;
53 public function getEncoding()
55 return 'ASCII';
58 public function toString()
60 return 'MIME-Version: ' . $this->getFieldValue();
63 /**
64 * Set the version string used in this header
66 * @param string $version
67 * @return MimeVersion
69 public function setVersion($version)
71 $this->version = $version;
72 return $this;
75 /**
76 * Retrieve the version string for this header
78 * @return string
80 public function getVersion()
82 return $this->version;