11<?php
22/**
3- * ParseStreamHttpClient - Stream http client
4- *
5- * @author Ben Friedman <ben@axolsoft.com>
3+ * Class ParseStreamHttpClient | Parse/HttpClients/ParseStreamHttpClient.php
64 */
75
86namespace Parse \HttpClients ;
97
108use Parse \ParseException ;
119
10+ /**
11+ * Class ParseStreamHttpClient - Stream http client
12+ *
13+ * @author Ben Friedman <ben@axolsoft.com>
14+ * @package Parse\HttpClients
15+ */
1216class ParseStreamHttpClient implements ParseHttpable
1317{
1418 /**
1519 * Stream handle
20+ *
1621 * @var ParseStream
1722 */
1823 private $ parseStream ;
1924
2025 /**
2126 * Request Headers
27+ *
2228 * @var array
2329 */
2430 private $ headers = array ();
2531
2632 /**
2733 * Response headers
34+ *
2835 * @var array
2936 */
3037 private $ responseHeaders = array ();
3138
3239 /**
3340 * Response code
41+ *
3442 * @var int
3543 */
3644 private $ responseCode = 0 ;
3745
3846 /**
3947 * Content type of our response
48+ *
4049 * @var string|null
4150 */
4251 private $ responseContentType ;
4352
4453 /**
4554 * Stream error code
55+ *
4656 * @var int
4757 */
4858 private $ streamErrorCode ;
4959
5060 /**
5161 * Stream error message
62+ *
5263 * @var string
5364 */
5465 private $ streamErrorMessage ;
5566
5667 /**
5768 * Options to pass to our stream
69+ *
5870 * @var array
5971 */
6072 private $ options = array ();
6173
6274 /**
6375 * Optional CA file to verify our peers with
76+ *
6477 * @var string
6578 */
6679 private $ caFile ;
6780
6881 /**
6982 * Response from our request
83+ *
7084 * @var string
7185 */
7286 private $ response ;
7387
88+ /**
89+ * ParseStreamHttpClient constructor.
90+ */
7491 public function __construct ()
7592 {
7693 if (!isset ($ this ->parseStream )) {
@@ -143,6 +160,9 @@ private function buildRequestHeaders()
143160 return implode ("\r\n" , $ headers );
144161 }
145162
163+ /**
164+ * Sets up ssl related options for the stream context
165+ */
146166 public function setup ()
147167 {
148168 // setup ssl options
@@ -154,6 +174,15 @@ public function setup()
154174 );
155175 }
156176
177+ /**
178+ * Sends an HTTP request
179+ *
180+ * @param string $url Url to send this request to
181+ * @param string $method Method to send this request via
182+ * @param array $data Data to send in this request
183+ * @return string
184+ * @throws ParseException
185+ */
157186 public function send ($ url , $ method = 'GET ' , $ data = array ())
158187 {
159188
@@ -287,6 +316,11 @@ public function getErrorMessage()
287316 return $ this ->streamErrorMessage ;
288317 }
289318
319+ /**
320+ * Sets a connection timeout. UNUSED in the stream client.
321+ *
322+ * @param int $timeout Timeout to set
323+ */
290324 public function setConnectionTimeout ($ timeout )
291325 {
292326 // do nothing
0 commit comments