Skip to content

Commit b6fa713

Browse files
committed
code cleanup
1 parent 8262068 commit b6fa713

File tree

5 files changed

+42
-20
lines changed

5 files changed

+42
-20
lines changed

src/Resources/ApiResource.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ abstract class ApiResource
2828

2929
/**
3030
* ApiResource constructor.
31-
* @param MailchimpRequest $request
31+
*
32+
* @param MailchimpRequest $request
3233
* @param MailchimpSettings|null $settings
3334
*/
3435
public function __construct(MailchimpRequest $request, MailchimpSettings $settings = null)
@@ -75,7 +76,9 @@ public function setSettings($settings)
7576

7677
/**
7778
* Makes a get request using the current request
79+
*
7880
* @param array $query_params an array of query parameters you want to send
81+
*
7982
* @return MailchimpResponse
8083
* @throws MailchimpException
8184
*/
@@ -94,7 +97,9 @@ public function get($query_params = [])
9497

9598
/**
9699
* Makes a post request using the current request
100+
*
97101
* @param array $params the payload you want to send
102+
*
98103
* @return MailchimpResponse
99104
* @throws MailchimpException
100105
*/
@@ -112,7 +117,9 @@ public function post($params = [])
112117

113118
/**
114119
* Makes a patch request using the current request
120+
*
115121
* @param array $params the payload you want to send
122+
*
116123
* @return MailchimpResponse
117124
* @throws MailchimpException
118125
*/
@@ -130,7 +137,9 @@ public function patch($params = [])
130137

131138
/**
132139
* Makes a put request using the current request
140+
*
133141
* @param array $params the payload you want to send
142+
*
134143
* @return MailchimpResponse
135144
* @throws MailchimpException
136145
*/
@@ -168,9 +177,12 @@ public function delete()
168177

169178
/**
170179
* Returns a new connection from a request and settings
171-
* @param MailchimpRequest $request
180+
*
181+
* @param MailchimpRequest $request
172182
* @param MailchimpSettings $settings
183+
*
173184
* @return MailchimpConnection
185+
* @throws MailchimpException
174186
*/
175187
protected function getConnection(MailchimpRequest $request, MailchimpSettings $settings)
176188
{
@@ -189,8 +201,10 @@ private function resetRequest()
189201

190202
/**
191203
* Throws an exception if $check evaluates false
192-
* @param string $type the type of check
193-
* @param mixed $check the variable under test
204+
*
205+
* @param string $type the type of check
206+
* @param mixed $check the variable under test
207+
*
194208
* @throws MailchimpException
195209
*/
196210
protected function throwIfNot($type, $check)
@@ -209,8 +223,10 @@ protected function throwIfNot($type, $check)
209223

210224
/**
211225
* Makes a post request to an action endpoint on an API resource
212-
* @param $endpoint
226+
*
227+
* @param $endpoint
213228
* @param array $params
229+
*
214230
* @return MailchimpResponse
215231
* @throws MailchimpException
216232
*/

src/Responses/FailureResponse.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
namespace MailchimpAPI\Responses;
55

66

7-
use MailchimpAPI\MailchimpException;
8-
97
/**
108
* Class FailureResponse
119
* @package MailchimpAPI\Responses
@@ -14,9 +12,10 @@ class FailureResponse extends MailchimpResponse
1412
{
1513
/**
1614
* FailureResponse constructor.
17-
* @param $headers
18-
* @param $body
19-
* @param $http_code
15+
*
16+
* @param array $headers
17+
* @param string $body
18+
* @param int $http_code
2019
* @param callable|null $failure_callback
2120
*/
2221
public function __construct($headers, $body, $http_code, callable $failure_callback = null)

src/Responses/MailchimpResponse.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ abstract class MailchimpResponse
3030

3131
/**
3232
* MailchimpResponse constructor.
33+
*
3334
* @param $headers
3435
* @param $body
3536
* @param $http_code
@@ -51,7 +52,8 @@ public function getHeaders()
5152
}
5253

5354
/**
54-
* Sets the headers on thsi response object
55+
* Sets the headers on this response object
56+
*
5557
* @param array $headers
5658
*/
5759
public function setHeaders($headers)
@@ -70,6 +72,7 @@ public function getHttpCode()
7072

7173
/**
7274
* Sets the http response code for this response object
75+
*
7376
* @param mixed $http_code
7477
*/
7578
public function setHttpCode($http_code)
@@ -78,7 +81,8 @@ public function setHttpCode($http_code)
7881
}
7982

8083
/**
81-
* Sets the body for this resposne object
84+
* Sets the body for this response object
85+
*
8286
* @param mixed $body
8387
*/
8488
public function setBody($body)
@@ -97,13 +101,15 @@ public function getBody()
97101

98102
/**
99103
* Deserializes the response body to PHP object or array
104+
*
100105
* @param bool $to_array should we deserialize to an array
106+
*
101107
* @return mixed
102108
* @throws MailchimpException when cant deserialize response
103109
*/
104110
public function deserialize($to_array = false)
105111
{
106-
$decoded = json_decode($this->body, (bool) $to_array);
112+
$decoded = json_decode($this->body, (bool)$to_array);
107113
if (!$decoded) {
108114
throw new MailchimpException("Unable to deserialize response");
109115
}

src/Responses/SuccessResponse.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
namespace MailchimpAPI\Responses;
55

66

7-
use MailchimpAPI\MailchimpException;
8-
97
/**
108
* Class SuccessResponse
119
* @package MailchimpAPI\Responses
@@ -14,9 +12,10 @@ class SuccessResponse extends MailchimpResponse
1412
{
1513
/**
1614
* SuccessResponse constructor.
17-
* @param $headers
18-
* @param $body
19-
* @param $http_code
15+
*
16+
* @param array $headers
17+
* @param string $body
18+
* @param int $http_code
2019
* @param callable|null $success_callback
2120
*/
2221
public function __construct($headers, $body, $http_code, callable $success_callback = null)

src/Settings/MailchimpSettings.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ public function getCustomCurlSettings()
8282
*/
8383
public function setDebug($debug)
8484
{
85-
$this->debug = (bool) $debug;
85+
$this->debug = (bool)$debug;
8686
}
8787

8888
/**
8989
* Set the log file from an absolute path to a writable file
9090
* log file must already exist to be writable
91+
*
9192
* @param null $log_file
93+
*
9294
* @throws MailchimpException
9395
*/
9496
public function setLogFile($log_file)
@@ -105,7 +107,7 @@ public function setLogFile($log_file)
105107
*/
106108
public function setVerifySsl($verify_ssl)
107109
{
108-
$this->verify_ssl = (bool) $verify_ssl;
110+
$this->verify_ssl = (bool)$verify_ssl;
109111
}
110112

111113
/**

0 commit comments

Comments
 (0)