@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * client here, say. Otherwise we'll just make one. |
72 | 72 | * @throws Exception |
73 | 73 | */ |
74 | - public function __construct ($app_url, $app_name, $app_version, $api_key = null, $guzzle_client = null) |
|
74 | + public function __construct($app_url, $app_name, $app_version, $api_key = null, $guzzle_client = null) |
|
75 | 75 | { |
76 | 76 | if ((empty($app_url)) || (empty($app_name)) || (empty($app_version))) |
77 | 77 | { |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | // testing, but in the normal course of things we'll probably just |
89 | 89 | // create it ourselves. |
90 | 90 | $this->guzzle_client = $guzzle_client; |
91 | - if (! isset($this->guzzle_client)) |
|
91 | + if (!isset($this->guzzle_client)) |
|
92 | 92 | { |
93 | 93 | $this->guzzle_client = new \GuzzleHttp\Client(); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - private function getStandardHeaders () |
|
97 | + private function getStandardHeaders() |
|
98 | 98 | { |
99 | 99 | // I'd use Guzzle middleware for this, as we want to add it on |
100 | 100 | // every request, but how do I do that and support dependency |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ); |
106 | 106 | } |
107 | 107 | |
108 | - private function getOurUserAgent () |
|
108 | + private function getOurUserAgent() |
|
109 | 109 | { |
110 | 110 | // From the docs: |
111 | 111 | // Setting your user agent If possible, your user agent string should always use the following format: Application Name/Version | Plugin Name/Version |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return "{$this->app_name}/{$this->app_version} | Gothick\\AkismetClient/" . self::VERSION; |
116 | 116 | } |
117 | 117 | |
118 | - public function setApiKey ($api_key) |
|
118 | + public function setApiKey($api_key) |
|
119 | 119 | { |
120 | 120 | if (empty($api_key)) |
121 | 121 | { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->api_key = $api_key; |
125 | 125 | } |
126 | 126 | |
127 | - public function verifyKey ($api_key = null) |
|
127 | + public function verifyKey($api_key = null) |
|
128 | 128 | { |
129 | 129 | $verified = false; |
130 | 130 | $error = ''; |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * @param boolean $is_test |
189 | 189 | * Set to true for automated testing |
190 | 190 | */ |
191 | - public function commentCheck ($params = array(), $server_params = array(), $user_role = 'user', $is_test = false) |
|
191 | + public function commentCheck($params = array(), $server_params = array(), $user_role = 'user', $is_test = false) |
|
192 | 192 | { |
193 | 193 | // According to the Akismet docs, these two (and 'blog', which we have as $this->blog already) are |
194 | 194 | // the only required parameters. Seems odd, but hey. |
195 | - if (empty($params['user_ip']) || empty($params['user_agent'])) |
|
195 | + if (empty($params[ 'user_ip' ]) || empty($params[ 'user_agent' ])) |
|
196 | 196 | { |
197 | 197 | throw new \InvalidArgumentException(__METHOD__ . ' requires user_ip and user_agent in $params'); |
198 | 198 | } |
@@ -222,14 +222,14 @@ discard block |
||
222 | 222 | } |
223 | 223 | throw new Exception('Unexpected status code in ' . __METHOD__ . ': ' . $error); |
224 | 224 | } |
225 | - if (! $result) |
|
225 | + if (!$result) |
|
226 | 226 | { |
227 | 227 | throw new Exception('Unexpected error in ' . __METHOD__); |
228 | 228 | } |
229 | 229 | return $result; |
230 | 230 | } |
231 | 231 | |
232 | - private function apiUri ($method) |
|
232 | + private function apiUri($method) |
|
233 | 233 | { |
234 | 234 | if ($method == 'verify-key') |
235 | 235 | { |
@@ -153,8 +153,7 @@ discard block |
||
153 | 153 | // TODO: do we need to return debugging help anyway? I think |
154 | 154 | // Akismet sometimes sends hints back even with a valid response. |
155 | 155 | $verified = ($body == 'valid'); |
156 | - } |
|
157 | - else |
|
156 | + } else |
|
158 | 157 | { |
159 | 158 | $error = $status_code; |
160 | 159 | if ($response->hasHeader('X-akismet-debug-help')) |
@@ -212,8 +211,7 @@ discard block |
||
212 | 211 | if ($response->getStatusCode() == 200) |
213 | 212 | { |
214 | 213 | $result = new CommentCheckResult($response); |
215 | - } |
|
216 | - else |
|
214 | + } else |
|
217 | 215 | { |
218 | 216 | $error = (string) $response->getStatusCode(); |
219 | 217 | if ($response->hasHeader('X-akismet-debug-help')) |
@@ -234,8 +232,7 @@ discard block |
||
234 | 232 | if ($method == 'verify-key') |
235 | 233 | { |
236 | 234 | return "https://rest.akismet.com/1.1/verify-key"; |
237 | - } |
|
238 | - else |
|
235 | + } else |
|
239 | 236 | { |
240 | 237 | if (empty($this->api_key)) |
241 | 238 | { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | protected $pro_tip; |
21 | 21 | |
22 | - public function __construct (\GuzzleHttp\Psr7\Response $response) |
|
22 | + public function __construct(\GuzzleHttp\Psr7\Response $response) |
|
23 | 23 | { |
24 | 24 | if ($response->getStatusCode() != 200) |
25 | 25 | { |
@@ -4,7 +4,7 @@ |
||
4 | 4 | class Exception extends \Exception |
5 | 5 | { |
6 | 6 | |
7 | - public function __construct ($message, $code = 0, \Exception $previous = null) |
|
7 | + public function __construct($message, $code = 0, \Exception $previous = null) |
|
8 | 8 | { |
9 | 9 | parent::__construct('Gothick\AkismetClient: ' . $message, $code, |
10 | 10 | $previous); |