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 / AbstractMessage.php
blob7faab6625662aa5eccff59166b5773b36299e321
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;
12 use Zend\Stdlib\Message;
14 /**
15 * HTTP standard message (Request/Response)
17 * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
19 abstract class AbstractMessage extends Message
21 /**#@+
22 * @const string Version constant numbers
24 const VERSION_10 = '1.0';
25 const VERSION_11 = '1.1';
26 /**#@-*/
28 /**
29 * @var string
31 protected $version = self::VERSION_11;
33 /**
34 * @var Headers|null
36 protected $headers = null;
38 /**
39 * Set the HTTP version for this object, one of 1.0 or 1.1
40 * (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11)
42 * @param string $version (Must be 1.0 or 1.1)
43 * @return AbstractMessage
44 * @throws Exception\InvalidArgumentException
46 public function setVersion($version)
48 if ($version != self::VERSION_10 && $version != self::VERSION_11) {
49 throw new Exception\InvalidArgumentException(
50 'Not valid or not supported HTTP version: ' . $version
53 $this->version = $version;
54 return $this;
57 /**
58 * Return the HTTP version for this request
60 * @return string
62 public function getVersion()
64 return $this->version;
67 /**
68 * Provide an alternate Parameter Container implementation for headers in this object,
69 * (this is NOT the primary API for value setting, for that see getHeaders())
71 * @see getHeaders()
72 * @param Headers $headers
73 * @return AbstractMessage
75 public function setHeaders(Headers $headers)
77 $this->headers = $headers;
78 return $this;
81 /**
82 * Return the header container responsible for headers
84 * @return Headers
86 public function getHeaders()
88 if ($this->headers === null || is_string($this->headers)) {
89 // this is only here for fromString lazy loading
90 $this->headers = (is_string($this->headers)) ? Headers::fromString($this->headers) : new Headers();
93 return $this->headers;
96 /**
97 * Allow PHP casting of this object
99 * @return string
101 public function __toString()
103 return $this->toString();