Install zendframework via composer, update build.xml and run, updates to composer
[openemr.git] / vendor / zendframework / zendframework / library / Zend / Http / Header / Origin.php
blob01b95b94d7fa20ad1aa74cede535e081d422344b
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-2015 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 use Zend\Uri\UriFactory;
14 /**
15 * @throws Exception\InvalidArgumentException
16 * @see http://tools.ietf.org/id/draft-abarth-origin-03.html#rfc.section.2
18 class Origin implements HeaderInterface
20 /**
21 * @var string
23 protected $value = '';
25 public static function fromString($headerLine)
27 list($name, $value) = explode(': ', $headerLine, 2);
29 // check to ensure proper header type for this factory
30 if (strtolower($name) !== 'origin') {
31 throw new Exception\InvalidArgumentException('Invalid header line for Origin string: "' . $name . '"');
34 $uri = UriFactory::factory($value);
35 if (!$uri->isValid()) {
36 throw new Exception\InvalidArgumentException('Invalid header value for Origin key: "' . $name . '"');
39 return new static($value);
42 /**
43 * @param string|null $value
45 public function __construct($value = null)
47 if ($value) {
48 HeaderValue::assertValid($value);
49 $this->value = $value;
53 public function getFieldName()
55 return 'Origin';
58 public function getFieldValue()
60 return $this->value;
63 public function toString()
65 return 'Origin: ' . $this->getFieldValue();