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 / Http / Header / UserAgent.php
blobf7df7c4142d5a277265399b369f39a0fbbe64442
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\Http\Header;
12 /**
13 * @throws Exception\InvalidArgumentException
14 * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
16 class UserAgent implements HeaderInterface
19 public static function fromString($headerLine)
21 $header = new static();
23 list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
25 // check to ensure proper header type for this factory
26 if (str_replace(array('_', ' ', '.'), '-', strtolower($name)) !== 'user-agent') {
27 throw new Exception\InvalidArgumentException('Invalid header line for User-Agent string: "' . $name . '"');
30 // @todo implementation details
31 $header->value = $value;
33 return $header;
36 public function getFieldName()
38 return 'User-Agent';
41 public function getFieldValue()
43 return $this->value;
46 public function toString()
48 return 'User-Agent: ' . $this->getFieldValue();