This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/zendframework/zf2
- Loading branch information
52 parents
8c2d88a
+
072c64d
+
d3c9780
+
9c15ae8
+
66a4342
+
85c9491
+
8ec8384
+
004366f
+
55a086d
+
ac7c7af
+
f02a226
+
00c4ac3
+
3f52720
+
5508474
+
49ed2f6
+
d562686
+
67b42b2
+
bdb1dae
+
9809630
+
7304e37
+
752a5af
+
8181c8f
+
53bdac2
+
c2f9414
+
f6341e9
+
57cde95
+
c750616
+
293054e
+
7432649
+
63f13f6
+
44e0d4b
+
bc03833
+
c0ba21c
+
94e82a8
+
459f1f9
+
e0c8424
+
5ef6a39
+
58fd018
+
65e3b0b
+
d21655a
+
1d20fd1
+
fe81bc5
+
96fadae
+
927c00d
+
1fd7c61
+
de0cb77
+
66e902f
+
24354dc
+
9f886a2
+
845333c
+
96e9a1e
+
52fbeb6
commit 7f76d90
Showing
191 changed files
with
3,565 additions
and
2,054 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Http | ||
*/ | ||
|
||
namespace Zend\Http; | ||
|
||
use Zend\Stdlib\Message; | ||
|
||
/** | ||
* HTTP standard message (Request/Response) | ||
* | ||
* @category Zend | ||
* @package Zend_Http | ||
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4 | ||
*/ | ||
abstract class AbstractMessage extends Message | ||
{ | ||
/**#@+ | ||
* @const string Version constant numbers | ||
*/ | ||
const VERSION_10 = '1.0'; | ||
const VERSION_11 = '1.1'; | ||
/**#@-*/ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $version = self::VERSION_11; | ||
|
||
/** | ||
* @var Headers|null | ||
*/ | ||
protected $headers = null; | ||
|
||
/** | ||
* Set the HTTP version for this object, one of 1.0 or 1.1 | ||
* (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11) | ||
* | ||
* @param string $version (Must be 1.0 or 1.1) | ||
* @return AbstractMessage | ||
* @throws Exception\InvalidArgumentException | ||
*/ | ||
public function setVersion($version) | ||
{ | ||
if ($version != self::VERSION_10 && $version != self::VERSION_11) { | ||
throw new Exception\InvalidArgumentException( | ||
'Not valid or not supported HTTP version: ' . $version | ||
); | ||
} | ||
$this->version = $version; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Return the HTTP version for this request | ||
* | ||
* @return string | ||
*/ | ||
public function getVersion() | ||
{ | ||
return $this->version; | ||
} | ||
|
||
/** | ||
* Provide an alternate Parameter Container implementation for headers in this object, | ||
* (this is NOT the primary API for value setting, for that see getHeaders()) | ||
* | ||
* @see getHeaders() | ||
* @param Headers $headers | ||
* @return AbstractMessage | ||
*/ | ||
public function setHeaders(Headers $headers) | ||
{ | ||
$this->headers = $headers; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Return the header container responsible for headers | ||
* | ||
* @return Headers | ||
*/ | ||
public function getHeaders() | ||
{ | ||
if ($this->headers === null || is_string($this->headers)) { | ||
// this is only here for fromString lazy loading | ||
$this->headers = (is_string($this->headers)) ? Headers::fromString($this->headers) : new Headers(); | ||
} | ||
|
||
return $this->headers; | ||
} | ||
|
||
/** | ||
* Allow PHP casting of this object | ||
* | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.