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

15 files changed

+61
-20
lines changed

src/Client.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,14 @@ protected function getCookieId($cookie)
449449
*
450450
* @param array|ArrayIterator|Header\SetCookie|string $cookie
451451
* @param string $value
452-
* @param string $version
453-
* @param string $maxAge
454-
* @param string $domain
455452
* @param string $expire
456453
* @param string $path
454+
* @param string $domain
457455
* @param boolean $secure
458456
* @param boolean $httponly
457+
* @param string $maxAge
458+
* @param string $version
459+
* @throws Exception\InvalidArgumentException
459460
* @return Client
460461
*/
461462
public function addCookie($cookie, $value = null, $expire = null, $path = null, $domain = null, $secure = false, $httponly = true, $maxAge = null, $version = null)
@@ -483,6 +484,7 @@ public function addCookie($cookie, $value = null, $expire = null, $path = null,
483484
* Set an array of cookies
484485
*
485486
* @param array $cookies
487+
* @throws Exception\InvalidArgumentException
486488
* @return Client
487489
*/
488490
public function setCookies($cookies)
@@ -510,6 +512,7 @@ public function clearCookies()
510512
* Set the headers (for the request)
511513
*
512514
* @param Headers|array $headers
515+
* @throws Exception\InvalidArgumentException
513516
* @return Client
514517
*/
515518
public function setHeaders($headers)
@@ -585,6 +588,7 @@ public function getStream()
585588
/**
586589
* Create temporary stream
587590
*
591+
* @throws Exception\RuntimeException
588592
* @return resource
589593
*/
590594
protected function openTempStream()
@@ -619,6 +623,7 @@ protected function openTempStream()
619623
* @param string $user
620624
* @param string $password
621625
* @param string $type
626+
* @throws Exception\InvalidArgumentException
622627
* @return Client
623628
*/
624629
public function setAuth($user, $password, $type = self::AUTH_BASIC)
@@ -648,6 +653,8 @@ public function setAuth($user, $password, $type = self::AUTH_BASIC)
648653
* @param string $password
649654
* @param string $type
650655
* @param array $digest
656+
* @param null|string $entityBody
657+
* @throws Exception\InvalidArgumentException
651658
* @return string|boolean
652659
*/
653660
protected function calcAuthDigest($user, $password, $type = self::AUTH_BASIC, $digest = array(), $entityBody = null)
@@ -737,6 +744,7 @@ public function dispatch(Stdlib\RequestInterface $request, Stdlib\ResponseInterf
737744
* @param Request $request
738745
* @return Response
739746
* @throws Exception\RuntimeException
747+
* @throws Client\Exception\RuntimeException
740748
*/
741749
public function send(Request $request = null)
742750
{
@@ -970,8 +978,8 @@ public function removeFileUpload($filename)
970978
/**
971979
* Prepare Cookies
972980
*
973-
* @param string $uri
974981
* @param string $domain
982+
* @param string $path
975983
* @param boolean $secure
976984
* @return Header\Cookie|boolean
977985
*/
@@ -1002,6 +1010,9 @@ protected function prepareCookies($domain, $path, $secure)
10021010
/**
10031011
* Prepare the request headers
10041012
*
1013+
* @param resource|string $body
1014+
* @param Http $uri
1015+
* @throws Exception\RuntimeException
10051016
* @return array
10061017
*/
10071018
protected function prepareHeaders($body, $uri)

src/Client/Adapter/Curl.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ public function connect($host, $port = 80, $secure = false)
240240
* @param string $body
241241
* @return string $request
242242
* @throws AdapterException\RuntimeException If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option
243+
* @throws AdapterException\InvalidArgumentException if $method is currently not supported
243244
*/
244245
public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $body = '')
245246
{

src/Client/Adapter/Proxy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function connect($host, $port = 80, $secure = false)
9696
* @param string $http_ver
9797
* @param array $headers
9898
* @param string $body
99+
* @throws AdapterException\RuntimeException
99100
* @return string Request as string
100101
*/
101102
public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
@@ -179,6 +180,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
179180
* @param integer $port
180181
* @param string $http_ver
181182
* @param array $headers
183+
* @throws AdapterException\RuntimeException
182184
*/
183185
protected function connectHandshake($host, $port = 443, $http_ver = '1.1', array &$headers = array())
184186
{

src/Client/Adapter/Socket.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function __construct()
102102
* Set the configuration array for the adapter
103103
*
104104
* @param array|Traversable $options
105+
* @throws AdapterException\InvalidArgumentException
105106
*/
106107
public function setOptions($options = array())
107108
{
@@ -140,6 +141,7 @@ public function getConfig()
140141
* @since Zend Framework 1.9
141142
*
142143
* @param mixed $context Stream context or array of context options
144+
* @throws Exception\InvalidArgumentException
143145
* @return Socket
144146
*/
145147
public function setStreamContext($context)
@@ -319,6 +321,7 @@ public function connect($host, $port = 80, $secure = false)
319321
* @param string $http_ver
320322
* @param array $headers
321323
* @param string $body
324+
* @throws AdapterException\RuntimeException
322325
* @return string Request as string
323326
*/
324327
public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
@@ -373,6 +376,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
373376
/**
374377
* Read response from server
375378
*
379+
* @throws AdapterException\RuntimeException
376380
* @return string
377381
*/
378382
public function read()

src/Client/Adapter/Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function setNextRequestWillFail($flag)
8080
* Set the configuration array for the adapter
8181
*
8282
* @param array|Traversable $options
83+
* @throws Exception\InvalidArgumentException
8384
*/
8485
public function setOptions($options = array())
8586
{
@@ -205,6 +206,7 @@ public function addResponse($response)
205206
* response will be returned on the next call to read().
206207
*
207208
* @param integer $index
209+
* @throws Exception\OutOfRangeException
208210
*/
209211
public function setResponseIndex($index)
210212
{

src/Client/Cookies.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function __construct()
9696
*
9797
* @param Cookie|string $cookie
9898
* @param Uri\Uri|string $ref_uri Optional reference URI (for domain, path, secure)
99+
* @throws Exception\InvalidArgumentException if invalid $cookie value
99100
*/
100101
public function addCookie($cookie, $ref_uri = null)
101102
{
@@ -159,6 +160,7 @@ public function getAllCookies($ret_as = self::COOKIE_OBJECT)
159160
* @param boolean $matchSessionCookies Whether to send session cookies
160161
* @param int $ret_as Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
161162
* @param int $now Override the current time when checking for expiry time
163+
* @throws Exception\InvalidArgumentException if invalid URI
162164
* @return array|string
163165
*/
164166
public function getMatchingCookies($uri, $matchSessionCookies = true,
@@ -198,6 +200,7 @@ public function getMatchingCookies($uri, $matchSessionCookies = true,
198200
* @param Uri\Uri|string $uri The uri (domain and path) to match
199201
* @param string $cookie_name The cookie's name
200202
* @param int $ret_as Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
203+
* @throws Exception\InvalidArgumentException if invalid URI specified or invalid $ret_as value
201204
* @return Cookie|string
202205
*/
203206
public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
@@ -302,7 +305,7 @@ protected function _matchDomain($domain)
302305
/**
303306
* Return a subset of a domain-matching cookies that also match a specified path
304307
*
305-
* @param array $dom_array
308+
* @param array $domains
306309
* @param string $path
307310
* @return array
308311
*/

src/ClientStatic.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ protected static function getStaticClient()
4242
* @param string $url
4343
* @param array $query
4444
* @param array $headers
45+
* @param mixed $body
4546
* @return Response|boolean
4647
*/
47-
public static function get($url, $query=array(), $headers=array(), $body=null)
48+
public static function get($url, $query = array(), $headers = array(), $body = null)
4849
{
4950
if (empty($url)) {
5051
return false;
@@ -68,15 +69,18 @@ public static function get($url, $query=array(), $headers=array(), $body=null)
6869

6970
return self::getStaticClient()->send($request);
7071
}
72+
7173
/**
7274
* HTTP POST METHOD (static)
7375
*
7476
* @param string $url
7577
* @param array $params
7678
* @param array $headers
79+
* @param mixed $body
80+
* @throws Exception\InvalidArgumentException
7781
* @return Response|boolean
7882
*/
79-
public static function post($url, $params, $headers=array(), $body=null)
83+
public static function post($url, $params, $headers = array(), $body = null)
8084
{
8185
if (empty($url)) {
8286
return false;

src/Cookies.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function __construct(Headers $headers, $context = self::CONTEXT_REQUEST)
7373
*
7474
* @param Cookie|string $cookie
7575
* @param Uri\Uri|string $ref_uri Optional reference URI (for domain, path, secure)
76+
* @throws Exception\InvalidArgumentException
7677
*/
7778
public function addCookie(Cookie $cookie, $ref_uri = null)
7879
{
@@ -136,6 +137,7 @@ public function getAllCookies($ret_as = self::COOKIE_OBJECT)
136137
* @param boolean $matchSessionCookies Whether to send session cookies
137138
* @param int $ret_as Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
138139
* @param int $now Override the current time when checking for expiry time
140+
* @throws Exception\InvalidArgumentException if invalid URI specified
139141
* @return array|string
140142
*/
141143
public function getMatchingCookies($uri, $matchSessionCookies = true,
@@ -175,6 +177,7 @@ public function getMatchingCookies($uri, $matchSessionCookies = true,
175177
* @param Uri\Uri|string $uri The uri (domain and path) to match
176178
* @param string $cookie_name The cookie's name
177179
* @param int $ret_as Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
180+
* @throws Exception\InvalidArgumentException if invalid URI specified or invalid $ret_as value
178181
* @return Cookie|string
179182
*/
180183
public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
@@ -279,7 +282,7 @@ protected function _matchDomain($domain)
279282
/**
280283
* Return a subset of a domain-matching cookies that also match a specified path
281284
*
282-
* @param array $dom_array
285+
* @param array $domains
283286
* @param string $path
284287
* @return array
285288
*/
@@ -309,7 +312,7 @@ protected function _matchPath($domains, $path)
309312
* of the cookie.
310313
*
311314
* @param Response $response HTTP Response object
312-
* @param Uri\Uri|string $uri The requested URI
315+
* @param Uri\Uri|string $ref_uri The requested URI
313316
* @return Cookies
314317
* @todo Add the $uri functionality.
315318
*/

src/Header/AbstractAccept.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
namespace Zend\Http\Header;
1212

13+
use stdClass;
14+
1315
/**
1416
* Abstract Accept Header
1517
*
@@ -118,7 +120,7 @@ public function getFieldValuePartsFromHeaderLine($headerLine)
118120
* Parse the accept params belonging to a media range
119121
*
120122
* @param string $fieldValuePart
121-
* @return StdClass
123+
* @return stdClass
122124
*/
123125
protected function parseFieldValuePart($fieldValuePart)
124126
{
@@ -184,6 +186,7 @@ protected function getParametersFromFieldValuePart($fieldValuePart)
184186
/**
185187
* Get field value
186188
*
189+
* @param array|null $values
187190
* @return string
188191
*/
189192
public function getFieldValue($values = null)
@@ -207,9 +210,9 @@ public function getFieldValue($values = null)
207210
* Assemble and escape the field value parameters based on RFC 2616 section 2.1
208211
*
209212
* @todo someone should review this thoroughly
210-
* @param string value
213+
* @param string $value
211214
* @param string $key
212-
* @return void
215+
* @return string
213216
*/
214217
protected function assembleAcceptParam(&$value, $key)
215218
{
@@ -236,6 +239,7 @@ function($v) { return '\\' . $v[0]; },
236239
* @param string $type
237240
* @param int|float $priority
238241
* @param array (optional) $params
242+
* @throws Exception\InvalidArgumentException
239243
* @return Accept
240244
*/
241245
protected function addType($type, $priority = 1, array $params = array())
@@ -275,7 +279,7 @@ protected function addType($type, $priority = 1, array $params = array())
275279
/**
276280
* Does the header have the requested type?
277281
*
278-
* @param string $type
282+
* @param array|string $matchAgainst
279283
* @return bool
280284
*/
281285
protected function hasType($matchAgainst)
@@ -367,7 +371,7 @@ protected function matchAcceptParams($match1, $match2)
367371
/**
368372
* Add a key/value combination to the internal queue
369373
*
370-
* @param unknown_type $value
374+
* @param stdClass $value
371375
* @return number
372376
*/
373377
protected function addFieldValuePartToQueue($value)

src/Header/Accept.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function toString()
4848
*
4949
* @param string $type
5050
* @param int|float $priority
51-
* @param int $level
51+
* @param array $params
5252
* @return Accept
5353
*/
5454
public function addMediaType($type, $priority = 1, array $params = array())
@@ -70,7 +70,7 @@ public function hasMediaType($type)
7070
/**
7171
* Parse the keys contained in the header line
7272
*
73-
* @param string mediaType
73+
* @param string $fieldValuePart
7474
* @return \Zend\Http\Header\Accept\FieldValuePart\CharsetFieldValuePart
7575
* @see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()
7676
*/

src/Header/Accept/FieldValuePart/AbstractFieldValuePart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getPriority()
6262
}
6363

6464
/**
65-
* @return StdClass $params
65+
* @return \stdClass $params
6666
*/
6767
public function getParams()
6868
{

src/Header/AcceptCharset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function hasCharset($type)
6868
/**
6969
* Parse the keys contained in the header line
7070
*
71-
* @param string mediaType
71+
* @param string $fieldValuePart
7272
* @return \Zend\Http\Header\Accept\FieldValuePart\CharsetFieldValuePart
7373
* @see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()
7474
*/

src/Header/AcceptEncoding.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function hasEncoding($type)
6969
/**
7070
* Parse the keys contained in the header line
7171
*
72-
* @param string mediaType
72+
* @param string $fieldValuePart
7373
* @return \Zend\Http\Header\Accept\FieldValuePart\EncodingFieldValuePart
7474
* @see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()
7575
*/

src/Header/AcceptLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function hasLanguage($type)
7070
/**
7171
* Parse the keys contained in the header line
7272
*
73-
* @param string mediaType
73+
* @param string $fieldValuePart
7474
* @return \Zend\Http\Header\Accept\FieldValuePart\LanguageFieldValuePart
7575
* @see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()
7676
*/

0 commit comments

Comments
 (0)