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

Commit c300b5a

Browse files
committed
Merge branch 'master' of git://github.com/zendframework/zf2 into cache_missingItems
2 parents 9594ad4 + 293054e commit c300b5a

24 files changed

+510
-362
lines changed

.travis/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for tested in "${testedcomponents[@]}"
88
do
99
echo "$tested:"
1010
phpunit -c $testdir/phpunit.xml $testdir/$tested
11-
let "result = $result || $?"
11+
result=$(($result || $?))
1212
done
1313

14-
exit $result
14+
exit $result

.travis/tested-components

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Zend/Crypt
1010
Zend/Currency
1111
Zend/Db
1212
Zend/Di
13-
Zend/Docbook
13+
Zend/DocBook
1414
Zend/Dojo
1515
Zend/Dom
1616
Zend/EventManager

src/Client.php

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@
2323
use ArrayIterator,
2424
Zend\Config\Config,
2525
Zend\Uri\Http,
26-
Zend\Http\Header\Cookie,
27-
Zend\Http\Header\SetCookie,
28-
Zend\Http\Request as HttpRequest,
29-
Zend\Http\Response as HttpResponse,
30-
Zend\Http\Response\Stream as HttpResponseStream,
31-
Zend\Stdlib\Parameters,
32-
Zend\Stdlib\DispatchableInterface as Dispatchable,
33-
Zend\Stdlib\RequestInterface as Request,
34-
Zend\Stdlib\ResponseInterface as Response;
26+
Zend\Stdlib;
3527

3628
/**
3729
* Http client
@@ -41,7 +33,7 @@
4133
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
4234
* @license http://framework.zend.com/license/new-bsd New BSD License
4335
*/
44-
class Client implements Dispatchable
36+
class Client implements Stdlib\DispatchableInterface
4537
{
4638
/**
4739
* @const string Supported HTTP Authentication methods
@@ -126,7 +118,7 @@ class Client implements Dispatchable
126118
'useragent' => 'Zend\Http\Client',
127119
'timeout' => 10,
128120
'adapter' => 'Zend\Http\Client\Adapter\Socket',
129-
'httpversion' => HttpRequest::VERSION_11,
121+
'httpversion' => Request::VERSION_11,
130122
'storeresponse' => true,
131123
'keepalive' => false,
132124
'outputstream' => false,
@@ -249,7 +241,7 @@ public function setRequest(Request $request)
249241
public function getRequest()
250242
{
251243
if (empty($this->request)) {
252-
$this->request = new HttpRequest();
244+
$this->request = new Request();
253245
}
254246
return $this->request;
255247
}
@@ -274,7 +266,7 @@ public function setResponse(Response $response)
274266
public function getResponse()
275267
{
276268
if (empty($this->response)) {
277-
$this->response = new HttpResponse();
269+
$this->response = new Response();
278270
}
279271
return $this->response;
280272
}
@@ -313,7 +305,7 @@ public function getRedirectionsCount()
313305
/**
314306
* Set Uri (to the request)
315307
*
316-
* @param string|\Zend\Uri\Http $uri
308+
* @param string|Http $uri
317309
* @return Client
318310
*/
319311
public function setUri($uri)
@@ -354,8 +346,8 @@ public function setMethod($method)
354346
{
355347
$method = $this->getRequest()->setMethod($method)->getMethod();
356348

357-
if (($method == HttpRequest::METHOD_POST || $method == HttpRequest::METHOD_PUT ||
358-
$method == HttpRequest::METHOD_DELETE || $method == HttpRequest::METHOD_PATCH)
349+
if (($method == Request::METHOD_POST || $method == Request::METHOD_PUT ||
350+
$method == Request::METHOD_DELETE || $method == Request::METHOD_PATCH)
359351
&& empty($this->encType)) {
360352
$this->setEncType(self::ENC_URLENCODED);
361353
}
@@ -395,7 +387,7 @@ public function setEncType($encType, $boundary = null)
395387
/**
396388
* Get the encoding type
397389
*
398-
* @return type
390+
* @return string
399391
*/
400392
public function getEncType()
401393
{
@@ -451,12 +443,12 @@ public function getCookies()
451443
/**
452444
* Get the cookie Id (name+domain+path)
453445
*
454-
* @param SetCookie|Cookie $cookie
446+
* @param Header\SetCookie|Header\Cookie $cookie
455447
* @return string|boolean
456448
*/
457449
protected function getCookieId($cookie)
458450
{
459-
if (($cookie instanceof SetCookie) || ($cookie instanceof Cookie)) {
451+
if (($cookie instanceof Header\SetCookie) || ($cookie instanceof Header\Cookie)) {
460452
return $cookie->getName() . $cookie->getDomain() . $cookie->getPath();
461453
}
462454
return false;
@@ -465,7 +457,7 @@ protected function getCookieId($cookie)
465457
/**
466458
* Add a cookie
467459
*
468-
* @param array|ArrayIterator|SetCookie|string $cookie
460+
* @param array|ArrayIterator|Header\SetCookie|string $cookie
469461
* @param string $value
470462
* @param string $version
471463
* @param string $maxAge
@@ -476,20 +468,20 @@ protected function getCookieId($cookie)
476468
* @param boolean $httponly
477469
* @return Client
478470
*/
479-
public function addCookie($cookie, $value = null, $version = null, $maxAge = null, $domain = null, $expire = null, $path = null, $secure = false, $httponly = true)
471+
public function addCookie($cookie, $value = null, $expire = null, $path = null, $domain = null, $secure = false, $httponly = true, $maxAge = null, $version = null)
480472
{
481473
if (is_array($cookie) || $cookie instanceof ArrayIterator) {
482474
foreach ($cookie as $setCookie) {
483-
if ($setCookie instanceof SetCookie) {
475+
if ($setCookie instanceof Header\SetCookie) {
484476
$this->cookies[$this->getCookieId($setCookie)] = $setCookie;
485477
} else {
486478
throw new Exception\InvalidArgumentException('The cookie parameter is not a valid Set-Cookie type');
487479
}
488480
}
489-
} elseif ($cookie instanceof SetCookie) {
481+
} elseif ($cookie instanceof Header\SetCookie) {
490482
$this->cookies[$this->getCookieId($cookie)] = $cookie;
491483
} elseif (is_string($cookie) && $value !== null) {
492-
$setCookie = new SetCookie($cookie, $value, $version, $maxAge, $domain, $expire, $path, $secure, $httponly);
484+
$setCookie = new Header\SetCookie($cookie, $value, $expire, $path, $domain, $secure, $httponly, $maxAge, $version);
493485
$this->cookies[$this->getCookieId($setCookie)] = $setCookie;
494486
} else {
495487
throw new Exception\InvalidArgumentException('Invalid parameter type passed as Cookie');
@@ -736,11 +728,11 @@ public function resetParameters($clearCookies = false)
736728
/**
737729
* Dispatch
738730
*
739-
* @param Request $request
740-
* @param Response $response
741-
* @return Response
731+
* @param Stdlib\RequestInterface $request
732+
* @param Stdlib\ResponseInterface $response
733+
* @return Stdlib\ResponseInterface
742734
*/
743-
public function dispatch(Request $request, Response $response = null)
735+
public function dispatch(Stdlib\RequestInterface $request, Stdlib\ResponseInterface $response = null)
744736
{
745737
$response = $this->send($request);
746738
return $response;
@@ -791,7 +783,7 @@ public function send(Request $request = null)
791783
$newUri .= '?' . $queryString;
792784
}
793785

794-
$uri = new \Zend\Uri\Http($newUri);
786+
$uri = new Http($newUri);
795787
}
796788
}
797789
// If we have no ports, set the defaults
@@ -850,14 +842,14 @@ public function send(Request $request = null)
850842
}
851843
// cleanup the adapter
852844
$this->adapter->setOutputStream(null);
853-
$response = HttpResponseStream::fromStream($response, $stream);
845+
$response = Response\Stream::fromStream($response, $stream);
854846
$response->setStreamName($this->streamName);
855847
if (!is_string($this->config['outputstream'])) {
856848
// we used temp name, will need to clean up
857849
$response->setCleanup(true);
858850
}
859851
} else {
860-
$response = HttpResponse::fromString($response);
852+
$response = Response::fromString($response);
861853
}
862854

863855
// Get the cookies from response (if any)
@@ -880,7 +872,7 @@ public function send(Request $request = null)
880872
$response->getStatusCode() == 301))) {
881873

882874
$this->resetParameters();
883-
$this->setMethod(HttpRequest::METHOD_GET);
875+
$this->setMethod(Request::METHOD_GET);
884876
}
885877

886878
// If we got a well formed absolute URI
@@ -984,7 +976,7 @@ public function removeFileUpload($filename)
984976
* @param string $uri
985977
* @param string $domain
986978
* @param boolean $secure
987-
* @return Cookie|boolean
979+
* @return Header\Cookie|boolean
988980
*/
989981
protected function prepareCookies($domain, $path, $secure)
990982
{
@@ -1004,7 +996,7 @@ protected function prepareCookies($domain, $path, $secure)
1004996
}
1005997
}
1006998

1007-
$cookies = Cookie::fromSetCookieArray($validCookies);
999+
$cookies = Header\Cookie::fromSetCookieArray($validCookies);
10081000
$cookies->setEncodeValue($this->config['encodecookies']);
10091001

10101002
return $cookies;
@@ -1020,7 +1012,7 @@ protected function prepareHeaders($body, $uri)
10201012
$headers = array();
10211013

10221014
// Set the host header
1023-
if ($this->config['httpversion'] == HttpRequest::VERSION_11) {
1015+
if ($this->config['httpversion'] == Request::VERSION_11) {
10241016
$host = $uri->getHost();
10251017
// If the port is not default, add it
10261018
if (!(($uri->getScheme() == 'http' && $uri->getPort() == 80) ||
@@ -1158,7 +1150,7 @@ protected function prepareBody()
11581150
*
11591151
* This method will try to detect the MIME type of a file. If the fileinfo
11601152
* extension is available, it will be used. If not, the mime_magic
1161-
* extension which is deprected but is still available in many PHP setups
1153+
* extension which is deprecated but is still available in many PHP setups
11621154
* will be tried.
11631155
*
11641156
* If neither extension is available, the default application/octet-stream

src/Client/Adapter/Exception.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
namespace Zend\Http\Client\Adapter;
2323

2424
/**
25-
* @uses \Zend\Http\Client\Exception
2625
* @category Zend
2726
* @package Zend_Http
2827
* @subpackage Client_Adapter

src/Client/Adapter/Exception/InitializationException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @category Zend
2727
* @package Zend_Application
28-
* @uses \Zend\Http\Client\Adapter\Exception
2928
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
3029
* @license http://framework.zend.com/license/new-bsd New BSD License
3130
*/

src/Client/Adapter/Exception/InvalidArgumentException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @category Zend
2727
* @package Zend_Application
28-
* @uses \Zend\Http\Client\Adapter\Exception
2928
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
3029
* @license http://framework.zend.com/license/new-bsd New BSD License
3130
*/

src/Client/Adapter/Exception/OutOfRangeException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @category Zend
2727
* @package Zend_Application
28-
* @uses \Zend\Http\Client\Adapter\Exception
2928
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
3029
* @license http://framework.zend.com/license/new-bsd New BSD License
3130
*/

src/Client/Adapter/Exception/RuntimeException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @category Zend
2727
* @package Zend_Application
28-
* @uses \Zend\Http\Client\Adapter\Exception
2928
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
3029
* @license http://framework.zend.com/license/new-bsd New BSD License
3130
*/

src/Client/Adapter/Exception/TimeoutException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @category Zend
2727
* @package Zend_Application
28-
* @uses \Zend\Http\Client\Adapter\Exception
2928
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
3029
* @license http://framework.zend.com/license/new-bsd New BSD License
3130
*/

src/Client/Exception.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
namespace Zend\Http\Client;
2323

2424
/**
25-
* @uses \Zend\Http\Exception
2625
* @category Zend
2726
* @package Zend_Http
2827
* @subpackage Client

0 commit comments

Comments
 (0)