From: Jan Schneider Date: Tue, 12 Jan 2010 10:20:20 +0000 (+0100) Subject: More phpdoc. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0b96bc120fcff8ebaf5899c2bd0509b4b823ac06;p=horde.git More phpdoc. --- diff --git a/framework/Http/lib/Horde/Http/Client.php b/framework/Http/lib/Horde/Http/Client.php index 913b46156..76989087c 100644 --- a/framework/Http/lib/Horde/Http/Client.php +++ b/framework/Http/lib/Horde/Http/Client.php @@ -88,6 +88,7 @@ class Horde_Http_Client /** * Send a GET request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function get($uri = null, $headers = array()) @@ -98,6 +99,7 @@ class Horde_Http_Client /** * Send a POST request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function post($uri = null, $data = null, $headers = array()) @@ -108,6 +110,7 @@ class Horde_Http_Client /** * Send a PUT request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function put($uri = null, $data = null, $headers = array()) @@ -123,6 +126,7 @@ class Horde_Http_Client /** * Send a DELETE request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function delete($uri = null, $headers = array()) @@ -139,6 +143,7 @@ class Horde_Http_Client * Send a HEAD request * @TODO * + * @throws Horde_Http_Exception * @return ? Probably just the status */ public function head($uri = null, $headers = array()) @@ -149,14 +154,15 @@ class Horde_Http_Client /** * Send an HTTP request * - * @param string $method HTTP request method (GET, PUT, etc.) - * @param string $uri URI to request, if different from $this->uri - * @param mixed $data Request data. Can be an array of form data that will be - * encoded automatically, or a raw string. - * @param array $headers Any headers specific to this request. They will - * be combined with $this->_headers, and override - * headers of the same name for this request only. + * @param string $method HTTP request method (GET, PUT, etc.) + * @param string $uri URI to request, if different from $this->uri + * @param mixed $data Request data. Can be an array of form data that + * will be encoded automatically, or a raw string. + * @param array $headers Any headers specific to this request. They will + * be combined with $this->_headers, and override + * headers of the same name for this request only. * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function request($method, $uri = null, $data = null, $headers = array()) diff --git a/framework/Http/lib/Horde/Http/Request/Curl.php b/framework/Http/lib/Horde/Http/Request/Curl.php index 11dc1ca7a..60b9296a4 100644 --- a/framework/Http/lib/Horde/Http/Request/Curl.php +++ b/framework/Http/lib/Horde/Http/Request/Curl.php @@ -17,7 +17,9 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base { /** - * Map of HTTP authentication schemes from Horde_Http constants to HTTP_AUTH constants. + * Map of HTTP authentication schemes from Horde_Http constants to + * HTTP_AUTH constants. + * * @var array */ protected $_httpAuthSchemes = array( @@ -30,6 +32,8 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base /** * Constructor + * + * @throws Horde_Http_Exception */ public function __construct($args = array()) { @@ -43,6 +47,7 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base /** * Send this HTTP request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function send() @@ -60,7 +65,9 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base // POST data isn't passed. $data = http_build_query($data); } - if ($data) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } + if ($data) { + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + } // Proxy settings if ($this->proxyServer) { @@ -99,6 +106,7 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base * Translate a Horde_Http::AUTH_* constant to CURLAUTH_* * * @param const + * @throws Horde_Http_Exception * @return const */ protected function _httpAuthScheme($httpAuthScheme) diff --git a/framework/Http/lib/Horde/Http/Request/Fopen.php b/framework/Http/lib/Horde/Http/Request/Fopen.php index af3658626..d2186fe6b 100644 --- a/framework/Http/lib/Horde/Http/Request/Fopen.php +++ b/framework/Http/lib/Horde/Http/Request/Fopen.php @@ -16,6 +16,11 @@ */ class Horde_Http_Request_Fopen extends Horde_Http_Request_Base { + /** + * Constructor + * + * @throws Horde_Http_Exception + */ public function __construct($args = array()) { if (!ini_get('allow_url_fopen')) { @@ -28,6 +33,7 @@ class Horde_Http_Request_Fopen extends Horde_Http_Request_Base /** * Send this HTTP request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function send() diff --git a/framework/Http/lib/Horde/Http/Request/Peclhttp.php b/framework/Http/lib/Horde/Http/Request/Peclhttp.php index b607bf90a..fe5b0305d 100644 --- a/framework/Http/lib/Horde/Http/Request/Peclhttp.php +++ b/framework/Http/lib/Horde/Http/Request/Peclhttp.php @@ -57,6 +57,7 @@ class Horde_Http_Request_Peclhttp extends Horde_Http_Request_Base /** * Send this HTTP request * + * @throws Horde_Http_Exception * @return Horde_Http_Response_Base */ public function send() @@ -109,6 +110,7 @@ class Horde_Http_Request_Peclhttp extends Horde_Http_Request_Base * Translate a Horde_Http::AUTH_* constant to HTTP_AUTH_* * * @param const + * @throws Horde_Http_Exception * @return const */ protected function _httpAuthScheme($httpAuthScheme) diff --git a/framework/Http/lib/Horde/Http/Response/Base.php b/framework/Http/lib/Horde/Http/Response/Base.php index c7e514a42..3f1f2c407 100644 --- a/framework/Http/lib/Horde/Http/Response/Base.php +++ b/framework/Http/lib/Horde/Http/Response/Base.php @@ -17,34 +17,38 @@ abstract class Horde_Http_Response_Base { /** - * Fetched URI + * Fetched URI. + * * @var string */ public $uri; /** - * HTTP protocol version that was used + * HTTP protocol version that was used. + * * @var float */ public $httpVersion; /** - * HTTP response code + * HTTP response code. + * * @var integer */ public $code; /** - * Response headers + * Response headers. + * * @var array */ public $headers; /** - * Parse an array of response headers, mindful of line - * continuations, etc. + * Parses an array of response headers, mindful of line continuations, etc. * * @param array $headers + * * @return array */ protected function _parseHeaders($headers) @@ -57,10 +61,11 @@ abstract class Horde_Http_Response_Base $lastHeader = null; foreach ($headers as $headerLine) { - // stream_get_meta returns all headers generated while processing a - // request, including ones for redirects before an eventually successful - // request. We just want the last one, so whenever we hit a new HTTP - // header, throw out anything parsed previously and start over. + // stream_get_meta returns all headers generated while processing + // a request, including ones for redirects before an eventually + // successful request. We just want the last one, so whenever we + // hit a new HTTP header, throw out anything parsed previously and + // start over. if (preg_match('/^HTTP\/(\d.\d) (\d{3})/', $headerLine, $httpMatches)) { $this->httpVersion = $httpMatches[1]; $this->code = (int)$httpMatches[2]; @@ -99,15 +104,16 @@ abstract class Horde_Http_Response_Base } /** - * Return the body of the HTTP response. + * Returns the body of the HTTP response. * + * @throws Horde_Http_Exception * @return string HTTP response body. */ abstract public function getBody(); /** - * Return a stream pointing to the response body that can be used - * with all standard PHP stream functions. + * Returns a stream pointing to the response body that can be used with all + * standard PHP stream functions. */ public function getStream() { @@ -116,9 +122,10 @@ abstract class Horde_Http_Response_Base } /** - * Get the value of a single response header. + * Returns the value of a single response header. * - * @param string $header Header name to get ('Content-Type', 'Content-Length', etc.). This is case sensitive. + * @param string $header Header name to get ('Content-Type', + * 'Content-Length', etc.). This is case sensitive. * * @return string HTTP header value. */ diff --git a/framework/Http/lib/Horde/Http/Response/Curl.php b/framework/Http/lib/Horde/Http/Response/Curl.php index f3a1b97d2..050ab0ef1 100644 --- a/framework/Http/lib/Horde/Http/Response/Curl.php +++ b/framework/Http/lib/Horde/Http/Response/Curl.php @@ -17,19 +17,21 @@ class Horde_Http_Response_Curl extends Horde_Http_Response_Base { /** - * Info on the request obtained from curl_getinfo() + * Info on the request obtained from curl_getinfo(). + * * @var array */ protected $_info = array(); /** - * Response body + * Response body. + * * @var string */ protected $_body; /** - * Constructor + * Constructor. * * @param string $uri * @param string $curlresult @@ -43,7 +45,7 @@ class Horde_Http_Response_Curl extends Horde_Http_Response_Base } /** - * Return the body of the HTTP response. + * Returns the body of the HTTP response. * * @return string HTTP response body. */ @@ -53,29 +55,26 @@ class Horde_Http_Response_Curl extends Horde_Http_Response_Base } /** - * Parse the combined header/body result from cURL. + * Parses the combined header/body result from cURL. * * @param string $curlresult */ protected function _parseResult($curlresult) { $endOfHeaders = strpos($curlresult, "\r\n\r\n"); - $headers = substr($curlresult, 0, $endOfHeaders); $this->_parseHeaders($headers); - $this->_body = substr($curlresult, $endOfHeaders + 4); } /** - * Process the results of curl_getinfo + * Processes the results of curl_getinfo. * * @param array $curlinfo */ protected function _parseInfo($curlinfo) { $this->uri = $curlinfo['url']; - $this->_info = $curlinfo; } } diff --git a/framework/Http/lib/Horde/Http/Response/Fopen.php b/framework/Http/lib/Horde/Http/Response/Fopen.php index 47ea53586..7c26a2885 100644 --- a/framework/Http/lib/Horde/Http/Response/Fopen.php +++ b/framework/Http/lib/Horde/Http/Response/Fopen.php @@ -17,13 +17,14 @@ class Horde_Http_Response_Fopen extends Horde_Http_Response_Base { /** - * Response body + * Response body. + * * @var stream */ protected $_stream; /** - * Constructor + * Constructor. */ public function __construct($uri, $stream, $headers = array()) { @@ -33,8 +34,9 @@ class Horde_Http_Response_Fopen extends Horde_Http_Response_Base } /** - * Return the body of the HTTP response. + * Returns the body of the HTTP response. * + * @throws Horde_Http_Exception * @return string HTTP response body. */ public function getBody() @@ -47,8 +49,8 @@ class Horde_Http_Response_Fopen extends Horde_Http_Response_Base } /** - * Return a stream pointing to the response body that can be used - * with all standard PHP stream functions. + * Returns a stream pointing to the response body that can be used with + * all standard PHP stream functions. */ public function getStream() { diff --git a/framework/Http/lib/Horde/Http/Response/Peclhttp.php b/framework/Http/lib/Horde/Http/Response/Peclhttp.php index 27063ba62..bbfb94694 100644 --- a/framework/Http/lib/Horde/Http/Response/Peclhttp.php +++ b/framework/Http/lib/Horde/Http/Response/Peclhttp.php @@ -17,13 +17,14 @@ class Horde_Http_Response_Peclhttp extends Horde_Http_Response_Base { /** - * HttpMessage object + * HttpMessage object. + * * @var HttpMessage */ protected $_message; /** - * Constructor + * Constructor. * * @param string $uri * @param HttpMessage $message @@ -33,9 +34,7 @@ class Horde_Http_Response_Peclhttp extends Horde_Http_Response_Base $this->uri = $uri; $this->httpVersion = $message->getHttpVersion(); $this->code = $message->getResponseCode(); - $this->_message = $message; - foreach ($message->getHeaders() as $k => $v) { $this->headers[strtolower($k)] = $v; }