1010
1111/**
1212 * Class MailchimpConnection
13- * @package MailchimpAPI\Utilities
13+ * @package MailchimpAPI\Requests
1414 */
1515class MailchimpConnection implements HttpRequest
1616{
@@ -21,55 +21,59 @@ class MailchimpConnection implements HttpRequest
2121 const USER_AGENT = 'jhut89/Mailchimp-API-3.0-PHP (https://github.com/Jhut89/Mailchimp-API-3.0-PHP) ' ;
2222
2323 /**
24- * the url used to request an access token from mailchimp
24+ * The url used to request an access token from mailchimp
2525 */
2626 const TOKEN_REQUEST_URL = 'https://login.mailchimp.com/oauth2/token ' ;
2727
2828 /**
29- * the url used to request metadata about an access token
29+ * The url used to request metadata about an access token
3030 */
3131 const OAUTH_METADATA_URL = 'https://login.mailchimp.com/oauth2/metadata/ ' ;
3232
3333 /**
34+ * The current request object passed into this connection
3435 * @var MailchimpRequest
3536 */
3637 private $ current_request ;
3738
3839 /**
40+ * The current settings object passed into this connection
3941 * @var MailChimpSettings
4042 */
4143 private $ current_settings ;
4244
4345 /**
44- * raw response from mailchimp api
46+ * Raw response from mailchimp api
4547 * @var string
4648 */
4749 private $ response ;
4850
4951 /**
50- * response body
52+ * Response body
5153 * @var string
5254 */
5355 private $ response_body ;
5456
5557 /**
56- * an integer representation of the http response code
58+ * An integer representation of the http response code
5759 * @var int
5860 */
5961 private $ http_code ;
6062
6163 /**
62- * the parsed response headers from the request
64+ * The parsed response headers from the request
6365 * @var array
6466 */
6567 private $ headers = [];
6668
6769 /**
70+ * The curl handle for this connection
6871 * @var resource
6972 */
7073 private $ handle ;
7174
7275 /**
76+ * A holder for the option that are set on this connections handle
7377 * @var array
7478 */
7579 private $ current_options = [];
@@ -96,6 +100,7 @@ public function __construct(MailchimpRequest &$request, MailchimpSettings &$sett
96100
97101 /**
98102 * Prepares this connections handle for execution
103+ * @return void
99104 */
100105 private function prepareHandle ()
101106 {
@@ -150,6 +155,7 @@ private function setHandlerOptionsForMethod()
150155 }
151156
152157 /**
158+ * Executes a connection with the current request and settings
153159 * @throws MailchimpException
154160 * @return MailchimpResponse
155161 */
@@ -186,7 +192,7 @@ public function execute()
186192 }
187193
188194 /**
189- * Gets the currently set curl option by key
195+ * Gets the currently set curl options by key
190196 * @param $key
191197 * @return mixed
192198 */
@@ -211,9 +217,7 @@ public function setCurrentOptions($options)
211217 /**
212218 * Sets a curl option on the handler
213219 * Updates the current settings array with ne setting
214- * @param $name
215- * @param $value
216- * @return mixed|void
220+ * @inheritdoc
217221 */
218222 public function setOption ($ name , $ value )
219223 {
@@ -222,24 +226,23 @@ public function setOption($name, $value)
222226 }
223227
224228 /**
225- * @return mixed
229+ * @inheritdoc
226230 */
227231 public function executeCurl ()
228232 {
229233 return curl_exec ($ this ->handle );
230234 }
231235
232236 /**
233- * @param $name
234- * @return mixed
237+ * @inheritdoc
235238 */
236239 public function getInfo ($ name )
237240 {
238241 return curl_getinfo ($ this ->handle , $ name );
239242 }
240243
241244 /**
242- * @return mixed|void
245+ * @inheritdoc
243246 */
244247 public function close ()
245248 {
@@ -272,6 +275,10 @@ private function pushToHeaders($header)
272275 $ this ->headers [$ header [0 ]] = trim ($ header [1 ]);
273276 }
274277
278+ /**
279+ * A function for evaluating if a connection was successful
280+ * @return bool
281+ */
275282 private function isSuccess ()
276283 {
277284 return ($ this ->http_code > 199 && $ this ->http_code < 300 );
0 commit comments