Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit d792d43

Browse files
author
Grzegorz Drozd
committed
Merge remote-tracking branch 'upstream/master'
Conflicts: library/Zend/Soap/Wsdl.php tests/Zend/Soap/Server/DocumentLiteralWrapperTest.php tests/Zend/Soap/WsdlTest.php

File tree

194 files changed

+4906
-2539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+4906
-2539
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zendframework/zend-http",
3-
"description": "Zend\\Http component",
3+
"description": "provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests",
44
"license": "BSD-3-Clause",
55
"keywords": [
66
"zf2",
@@ -13,7 +13,7 @@
1313
}
1414
},
1515
"require": {
16-
"php": ">=5.3.23",
16+
"php": ">=5.3.3",
1717
"zendframework/zend-loader": "self.version",
1818
"zendframework/zend-stdlib": "self.version",
1919
"zendframework/zend-uri": "self.version",
@@ -25,14 +25,14 @@
2525
"dev-develop": "2.5-dev"
2626
}
2727
},
28-
"require-dev": {
29-
"fabpot/php-cs-fixer": "1.7.*",
30-
"satooshi/php-coveralls": "dev-master",
31-
"phpunit/PHPUnit": "~4.0"
32-
},
3328
"autoload-dev": {
3429
"psr-4": {
3530
"ZendTest\\Http\\": "test/"
3631
}
32+
},
33+
"require-dev": {
34+
"fabpot/php-cs-fixer": "1.7.*",
35+
"satooshi/php-coveralls": "dev-master",
36+
"phpunit/PHPUnit": "~4.0"
3737
}
3838
}

src/AbstractMessage.php

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?php
2+
/**
3+
* Zend Framework (http://framework.zend.com/)
4+
*
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+
* @package Zend_Http
9+
*/
10+
11+
namespace Zend\Http;
12+
13+
use Zend\Stdlib\Message;
14+
15+
/**
16+
* HTTP standard message (Request/Response)
17+
*
18+
* @category Zend
19+
* @package Zend_Http
20+
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
21+
*/
22+
abstract class AbstractMessage extends Message
23+
{
24+
/**#@+
25+
* @const string Version constant numbers
26+
*/
27+
const VERSION_10 = '1.0';
28+
const VERSION_11 = '1.1';
29+
/**#@-*/
30+
31+
/**
32+
* @var string
33+
*/
34+
protected $version = self::VERSION_11;
35+
36+
/**
37+
* @var Headers|null
38+
*/
39+
protected $headers = null;
40+
41+
/**
42+
* Set the HTTP version for this object, one of 1.0 or 1.1
43+
* (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11)
44+
*
45+
* @param string $version (Must be 1.0 or 1.1)
46+
* @return AbstractMessage
47+
* @throws Exception\InvalidArgumentException
48+
*/
49+
public function setVersion($version)
50+
{
51+
if ($version != self::VERSION_10 && $version != self::VERSION_11) {
52+
throw new Exception\InvalidArgumentException(
53+
'Not valid or not supported HTTP version: ' . $version
54+
);
55+
}
56+
$this->version = $version;
57+
return $this;
58+
}
59+
60+
/**
61+
* Return the HTTP version for this request
62+
*
63+
* @return string
64+
*/
65+
public function getVersion()
66+
{
67+
return $this->version;
68+
}
69+
70+
/**
71+
* Provide an alternate Parameter Container implementation for headers in this object,
72+
* (this is NOT the primary API for value setting, for that see getHeaders())
73+
*
74+
* @see getHeaders()
75+
* @param Headers $headers
76+
* @return AbstractMessage
77+
*/
78+
public function setHeaders(Headers $headers)
79+
{
80+
$this->headers = $headers;
81+
return $this;
82+
}
83+
84+
/**
85+
* Return the header container responsible for headers
86+
*
87+
* @return Headers
88+
*/
89+
public function getHeaders()
90+
{
91+
if ($this->headers === null || is_string($this->headers)) {
92+
// this is only here for fromString lazy loading
93+
$this->headers = (is_string($this->headers)) ? Headers::fromString($this->headers) : new Headers();
94+
}
95+
96+
return $this->headers;
97+
}
98+
99+
/**
100+
* Allow PHP casting of this object
101+
*
102+
* @return string
103+
*/
104+
public function __toString()
105+
{
106+
return $this->toString();
107+
}
108+
}

0 commit comments

Comments
 (0)