]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - extlib/HTTP/Request2/Adapter/Mock.php
Merge branch '1.0.x' into testing
[quix0rs-gnu-social.git] / extlib / HTTP / Request2 / Adapter / Mock.php
index 89688003b2352a57dc6618e1327394a135f9e0fd..c99defb899dc3a67feaec14803cfeaade3225c06 100644 (file)
@@ -6,7 +6,7 @@
  *\r
  * LICENSE:\r
  *\r
- * Copyright (c) 2008, 2009, Alexey Borzov <avb@php.net>\r
+ * Copyright (c) 2008-2011, Alexey Borzov <avb@php.net>\r
  * All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or without\r
@@ -37,7 +37,7 @@
  * @package    HTTP_Request2\r
  * @author     Alexey Borzov <avb@php.net>\r
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License\r
- * @version    CVS: $Id: Mock.php 274406 2009-01-23 18:01:57Z avb $\r
+ * @version    SVN: $Id: Mock.php 308322 2011-02-14 13:58:03Z avb $\r
  * @link       http://pear.php.net/package/HTTP_Request2\r
  */\r
 \r
@@ -55,31 +55,31 @@ require_once 'HTTP/Request2/Adapter.php';
  * <code>\r
  * $mock = new HTTP_Request2_Adapter_Mock();\r
  * $mock->addResponse("HTTP/1.1 ... ");\r
- * \r
+ *\r
  * $request = new HTTP_Request2();\r
  * $request->setAdapter($mock);\r
- * \r
+ *\r
  * // This will return the response set above\r
  * $response = $req->send();\r
- * </code> \r
+ * </code>\r
  *\r
  * @category   HTTP\r
  * @package    HTTP_Request2\r
  * @author     Alexey Borzov <avb@php.net>\r
- * @version    Release: 0.4.1\r
+ * @version    Release: 2.0.0RC1\r
  */\r
 class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter\r
 {\r
    /**\r
     * A queue of responses to be returned by sendRequest()\r
-    * @var  array \r
+    * @var  array\r
     */\r
     protected $responses = array();\r
 \r
    /**\r
     * Returns the next response from the queue built by addResponse()\r
     *\r
-    * If the queue is empty will return default empty response with status 400,\r
+    * If the queue is empty it will return default empty response with status 400,\r
     * if an Exception object was added to the queue it will be thrown.\r
     *\r
     * @param    HTTP_Request2\r
@@ -93,7 +93,7 @@ class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter
             if ($response instanceof HTTP_Request2_Response) {\r
                 return $response;\r
             } else {\r
-                // rethrow the exception,\r
+                // rethrow the exception\r
                 $class   = get_class($response);\r
                 $message = $response->getMessage();\r
                 $code    = $response->getCode();\r
@@ -108,7 +108,7 @@ class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter
     * Adds response to the queue\r
     *\r
     * @param    mixed   either a string, a pointer to an open file,\r
-    *                   a HTTP_Request2_Response or Exception object\r
+    *                   an instance of HTTP_Request2_Response or Exception\r
     * @throws   HTTP_Request2_Exception\r
     */\r
     public function addResponse($response)\r
@@ -135,7 +135,7 @@ class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter
     public static function createResponseFromString($str)\r
     {\r
         $parts       = preg_split('!(\r?\n){2}!m', $str, 2);\r
-        $headerLines = explode("\n", $parts[0]); \r
+        $headerLines = explode("\n", $parts[0]);\r
         $response    = new HTTP_Request2_Response(array_shift($headerLines));\r
         foreach ($headerLines as $headerLine) {\r
             $response->parseHeaderLine($headerLine);\r