Completed
Push — master ( e11220...7e1aad )
by John
01:58
created
src/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         }
33 33
         $cn = strtolower($class);
34 34
         if (isset($classes[$cn])) {
35
-            require(__DIR__ . $classes[$cn]);
35
+            require(__DIR__.$classes[$cn]);
36 36
         }
37 37
     }
38 38
 );
Please login to merge, or discard this patch.
src/authnet/AuthnetJsonResponse.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -224,10 +224,10 @@
 block discarded – undo
224 224
     }
225 225
 
226 226
     /**
227
-    * Gets the transaction response from Authorize.Net in JSON format for logging purposes
228
-    *
229
-    * @return  string transaction response from Authorize.Net in JSON format
230
-    */
227
+     * Gets the transaction response from Authorize.Net in JSON format for logging purposes
228
+     *
229
+     * @return  string transaction response from Authorize.Net in JSON format
230
+     */
231 231
     public function getRawResponse()
232 232
     {
233 233
         return $this->responseJson;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
     public function __toString()
131 131
     {
132 132
         $output  = '';
133
-        $output .= '<table summary="Authorize.Net Response" id="authnet-response">' . "\n";
134
-        $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Response JSON</b></th>' . "\n" . '</tr>' . "\n";
135
-        $output .= '<tr><td colspan="2"><pre>' . "\n";
136
-        $output .= $this->responseJson . "\n";
137
-        $output .= '</pre></td></tr>' . "\n";
133
+        $output .= '<table summary="Authorize.Net Response" id="authnet-response">'."\n";
134
+        $output .= '<tr>'."\n\t\t".'<th colspan="2"><b>Response JSON</b></th>'."\n".'</tr>'."\n";
135
+        $output .= '<tr><td colspan="2"><pre>'."\n";
136
+        $output .= $this->responseJson."\n";
137
+        $output .= '</pre></td></tr>'."\n";
138 138
         $output .= '</table>';
139 139
 
140 140
         return $output;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function isApproved()
180 180
     {
181
-        return $this->isSuccessful() && $this->checkTransactionStatus(self::STATUS_APPROVED) ;
181
+        return $this->isSuccessful() && $this->checkTransactionStatus(self::STATUS_APPROVED);
182 182
     }
183 183
 
184 184
     /**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function isDeclined()
190 190
     {
191
-        return $this->isSuccessful() && $this->checkTransactionStatus(self::STATUS_DECLINED) ;
191
+        return $this->isSuccessful() && $this->checkTransactionStatus(self::STATUS_DECLINED);
192 192
     }
193 193
 
194 194
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,8 +201,7 @@
 block discarded – undo
201 201
     {
202 202
         if ($this->transactionInfo instanceof TransactionResponse) {
203 203
             $match = (int) $this->transactionInfo->getTransactionResponseField('ResponseCode') === (int) $status;
204
-        }
205
-        else {
204
+        } else {
206 205
             $match = (int) $this->transactionResponse->responseCode === $status;
207 206
         }
208 207
         return $match;
Please login to merge, or discard this patch.
src/authnet/TransactionResponse.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@
 block discarded – undo
101 101
         $value = null;
102 102
         if (is_int($field)) {
103 103
             $value = (isset($this->responseArray[$field])) ? $this->responseArray[$field] : $value;
104
-        }
105
-        else {
104
+        } else {
106 105
             if ($key = array_search($field, $this->fieldMap)) {
107 106
                 $value = $this->responseArray[$key];
108 107
             }
Please login to merge, or discard this patch.
src/authnet/AuthnetSim.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
             $this->sequence,
83 83
             $this->timestamp,
84 84
             $amount
85
-        ),  $this->transactionKey);
85
+        ), $this->transactionKey);
86 86
     }
87 87
 
88 88
     /**
Please login to merge, or discard this patch.
src/authnet/AuthnetWebhooksRequest.php 2 patches
Doc Comments   +16 added lines, -15 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * Outputs the endpoint URL and request JSON in a human readable format
81 81
      *
82
-     * @return  array   list of event types
82
+     * @return  AuthnetWebhooksResponse   list of event types
83 83
      */
84 84
     public function getEventTypes()
85 85
     {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      *
99 99
      * @throws  \JohnConde\Authnet\AuthnetInvalidParameterException
100 100
      *
101
-     * @return  array   list of event types
101
+     * @return  AuthnetWebhooksResponse   list of event types
102 102
      */
103 103
     public function createWebhooks(Array $webhooks, $webhookUrl, $status = 'active')
104 104
     {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     /**
133 133
      * List all of your webhooks
134 134
      *
135
-     * @return  array   list of event types
135
+     * @return  AuthnetWebhooksResponse   list of event types
136 136
      */
137 137
     public function getWebhooks()
138 138
     {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      *
148 148
      * @param   string   $webhookId   Webhook ID to be retrieved
149 149
      *
150
-     * @return  array   list of event types
150
+     * @return  AuthnetWebhooksResponse   list of event types
151 151
      */
152 152
     public function getWebhook($webhookId)
153 153
     {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @throws  \JohnConde\Authnet\AuthnetInvalidParameterException
169 169
      *
170
-     * @return  array   list of event types
170
+     * @return  AuthnetWebhooksResponse   list of event types
171 171
      */
172 172
     public function updateWebhook($webhookId, $webhookUrl, Array $eventTypes, $status = 'active')
173 173
     {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @param   integer   $limit    Default: 1000
204 204
      * @param   integer   $offset   Default: 0
205 205
      *
206
-     * @return  array   list of event types
206
+     * @return  AuthnetWebhooksResponse   list of event types
207 207
      */
208 208
     public function getNotificationHistory($limit = 1000, $offset = 0)
209 209
     {
@@ -242,9 +242,10 @@  discard block
 block discarded – undo
242 242
     /**
243 243
      * Make GET request via Curl
244 244
      *
245
-     * @param   object  $url
245
+     * @param   string  $url
246 246
      *
247 247
      * @throws  \JohnConde\Authnet\AuthnetCurlException
248
+     * @return string
248 249
      */
249 250
     private function get($url) {
250 251
         $this->processor->get($url);
@@ -254,10 +255,11 @@  discard block
 block discarded – undo
254 255
     /**
255 256
      * Make POST request via Curl
256 257
      *
257
-     * @param   object  $url        API endpoint
258
-     * @param   object  $request    JSON request payload
258
+     * @param   string  $url        API endpoint
259
+     * @param   string  $request    JSON request payload
259 260
      *
260 261
      * @throws  \JohnConde\Authnet\AuthnetCurlException
262
+     * @return string
261 263
      */
262 264
     private function post($url, $request) {
263 265
         $this->processor->post($url, $request);
@@ -267,10 +269,11 @@  discard block
 block discarded – undo
267 269
     /**
268 270
      * Make PUT request via Curl
269 271
      *
270
-     * @param   object  $url        API endpoint
271
-     * @param   object  $request    JSON request payload
272
+     * @param   string  $url        API endpoint
273
+     * @param   string  $request    JSON request payload
272 274
      *
273 275
      * @throws  \JohnConde\Authnet\AuthnetCurlException
276
+     * @return string
274 277
      */
275 278
     private function put($url, $request) {
276 279
         $this->processor->put($url, $request, true);
@@ -280,9 +283,7 @@  discard block
 block discarded – undo
280 283
     /**
281 284
      * Make DELETE request via Curl
282 285
      *
283
-     * @param   object  $url        API endpoint
284
-     * @param   object  $request    JSON request payload
285
-     *
286
+     * @param   string  $url        API endpoint
286 287
      * @throws  \JohnConde\Authnet\AuthnetCurlException
287 288
      */
288 289
     private function delete($url) {
@@ -293,7 +294,7 @@  discard block
 block discarded – undo
293 294
     /**
294 295
      * Sets the handler to be used to handle our API call. Mainly used for unit testing as Curl is used by default.
295 296
      *
296
-     * @param   object  $processor
297
+     * @param   \Curl\Curl  $processor
297 298
      */
298 299
     public function setProcessHandler($processor)
299 300
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
     public function __toString()
63 63
     {
64 64
         $output  = '';
65
-        $output .= '<table summary="Authorize.Net Request" id="authnet-request">' . "\n";
66
-        $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Class Parameters</b></th>' . "\n" . '</tr>' . "\n";
67
-        $output .= '<tr>' . "\n\t\t" . '<td><b>Authnet Server URL</b></td><td>' . $this->url . '</td>' . "\n" . '</tr>' . "\n";
68
-        $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Request JSON</b></th>' . "\n" . '</tr>' . "\n";
65
+        $output .= '<table summary="Authorize.Net Request" id="authnet-request">'."\n";
66
+        $output .= '<tr>'."\n\t\t".'<th colspan="2"><b>Class Parameters</b></th>'."\n".'</tr>'."\n";
67
+        $output .= '<tr>'."\n\t\t".'<td><b>Authnet Server URL</b></td><td>'.$this->url.'</td>'."\n".'</tr>'."\n";
68
+        $output .= '<tr>'."\n\t\t".'<th colspan="2"><b>Request JSON</b></th>'."\n".'</tr>'."\n";
69 69
         if (!empty($this->requestJson)) {
70
-            $output .= '<tr><td colspan="2"><pre>' . "\n";
71
-            $output .= $this->requestJson . "\n";
72
-            $output .= '</pre></td></tr>' . "\n";
70
+            $output .= '<tr><td colspan="2"><pre>'."\n";
71
+            $output .= $this->requestJson."\n";
72
+            $output .= '</pre></td></tr>'."\n";
73 73
         }
74 74
         $output .= '</table>';
75 75
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     private function handleResponse()
225 225
     {
226
-        if(!$this->processor->error) {
226
+        if (!$this->processor->error) {
227 227
             return $this->processor->response;
228 228
         }
229 229
         $error_message = null;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                 $error_message = sprintf('(%u) %s: %s', $response->status, $response->reason, $response->message);
237 237
             }
238 238
         }
239
-        throw new AuthnetCurlException('Connection error: ' . $error_message . ' (' . $error_code . ')');
239
+        throw new AuthnetCurlException('Connection error: '.$error_message.' ('.$error_code.')');
240 240
     }
241 241
 
242 242
     /**
Please login to merge, or discard this patch.
src/authnet/AuthnetWebhooksResponse.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
     public function __toString()
61 61
     {
62 62
         $output  = '';
63
-        $output .= '<table summary="Authorize.Net Webhooks Response" id="authnet-response">' . "\n";
64
-        $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Response JSON</b></th>' . "\n" . '</tr>' . "\n";
65
-        $output .= '<tr><td colspan="2"><pre>' . "\n";
66
-        $output .= $this->responseJson . "\n";
67
-        $output .= '</pre></td></tr>' . "\n";
63
+        $output .= '<table summary="Authorize.Net Webhooks Response" id="authnet-response">'."\n";
64
+        $output .= '<tr>'."\n\t\t".'<th colspan="2"><b>Response JSON</b></th>'."\n".'</tr>'."\n";
65
+        $output .= '<tr><td colspan="2"><pre>'."\n";
66
+        $output .= $this->responseJson."\n";
67
+        $output .= '</pre></td></tr>'."\n";
68 68
         $output .= '</table>';
69 69
 
70 70
         return $output;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@
 block discarded – undo
104 104
             foreach ($this->response->eventTypes as $event) {
105 105
                 $events[] = $event;
106 106
             }
107
-        }
108
-        else {
107
+        } else {
109 108
             foreach ($this->response as $event) {
110 109
                 $events[] = $event->name;
111 110
             }
Please login to merge, or discard this patch.
src/authnet/AuthnetApiFactory.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -83,14 +83,11 @@  discard block
 block discarded – undo
83 83
     {
84 84
         if ($server === static::USE_PRODUCTION_SERVER) {
85 85
             $url = 'https://api.authorize.net/xml/v1/request.api';
86
-        }
87
-        else if ($server === static::USE_DEVELOPMENT_SERVER) {
86
+        } else if ($server === static::USE_DEVELOPMENT_SERVER) {
88 87
             $url = 'https://apitest.authorize.net/xml/v1/request.api';
89
-        }
90
-        else if ($server === static::USE_AKAMAI_SERVER) {
88
+        } else if ($server === static::USE_AKAMAI_SERVER) {
91 89
             $url = 'https://api2.authorize.net/xml/v1/request.api';
92
-        }
93
-        else {
90
+        } else {
94 91
             throw new AuthnetInvalidServerException('You did not provide a valid server.');
95 92
         }
96 93
         return $url;
@@ -129,11 +126,9 @@  discard block
 block discarded – undo
129 126
     {
130 127
         if ($server === static::USE_PRODUCTION_SERVER) {
131 128
             $url = 'https://secure2.authorize.net/gateway/transact.dll';
132
-        }
133
-        else if ($server === static::USE_DEVELOPMENT_SERVER) {
129
+        } else if ($server === static::USE_DEVELOPMENT_SERVER) {
134 130
             $url = 'https://test.authorize.net/gateway/transact.dll';
135
-        }
136
-        else {
131
+        } else {
137 132
             throw new AuthnetInvalidServerException('You did not provide a valid server.');
138 133
         }
139 134
         return $url;
@@ -184,11 +179,9 @@  discard block
 block discarded – undo
184 179
     {
185 180
         if ($server === static::USE_PRODUCTION_SERVER) {
186 181
             $url = 'https://api.authorize.net/rest/v1/';
187
-        }
188
-        else if ($server === static::USE_DEVELOPMENT_SERVER) {
182
+        } else if ($server === static::USE_DEVELOPMENT_SERVER) {
189 183
             $url = 'https://apitest.authorize.net/rest/v1/';
190
-        }
191
-        else {
184
+        } else {
192 185
             throw new AuthnetInvalidServerException('You did not provide a valid server.');
193 186
         }
194 187
         return $url;
Please login to merge, or discard this patch.
src/authnet/AuthnetJsonRequest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -105,16 +105,16 @@  discard block
 block discarded – undo
105 105
     public function __toString()
106 106
     {
107 107
         $output  = '';
108
-        $output .= '<table summary="Authorize.Net Request" id="authnet-request">' . "\n";
109
-        $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Class Parameters</b></th>' . "\n" . '</tr>' . "\n";
110
-        $output .= '<tr>' . "\n\t\t" . '<td><b>API Login ID</b></td><td>' . $this->login . '</td>' . "\n" . '</tr>' . "\n";
111
-        $output .= '<tr>' . "\n\t\t" . '<td><b>Transaction Key</b></td><td>' . $this->transactionKey . '</td>' . "\n" . '</tr>' . "\n";
112
-        $output .= '<tr>' . "\n\t\t" . '<td><b>Authnet Server URL</b></td><td>' . $this->url . '</td>' . "\n" . '</tr>' . "\n";
113
-        $output .= '<tr>' . "\n\t\t" . '<th colspan="2"><b>Request JSON</b></th>' . "\n" . '</tr>' . "\n";
108
+        $output .= '<table summary="Authorize.Net Request" id="authnet-request">'."\n";
109
+        $output .= '<tr>'."\n\t\t".'<th colspan="2"><b>Class Parameters</b></th>'."\n".'</tr>'."\n";
110
+        $output .= '<tr>'."\n\t\t".'<td><b>API Login ID</b></td><td>'.$this->login.'</td>'."\n".'</tr>'."\n";
111
+        $output .= '<tr>'."\n\t\t".'<td><b>Transaction Key</b></td><td>'.$this->transactionKey.'</td>'."\n".'</tr>'."\n";
112
+        $output .= '<tr>'."\n\t\t".'<td><b>Authnet Server URL</b></td><td>'.$this->url.'</td>'."\n".'</tr>'."\n";
113
+        $output .= '<tr>'."\n\t\t".'<th colspan="2"><b>Request JSON</b></th>'."\n".'</tr>'."\n";
114 114
         if (!empty($this->requestJson)) {
115
-            $output .= '<tr><td colspan="2"><pre>' . "\n";
116
-            $output .= $this->requestJson . "\n";
117
-            $output .= '</pre></td></tr>' . "\n";
115
+            $output .= '<tr><td colspan="2"><pre>'."\n";
116
+            $output .= $this->requestJson."\n";
117
+            $output .= '</pre></td></tr>'."\n";
118 118
         }
119 119
         $output .= '</table>';
120 120
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function __set($name, $value)
132 132
     {
133
-        throw new AuthnetCannotSetParamsException('You cannot set parameters directly in ' . __CLASS__ . '.');
133
+        throw new AuthnetCannotSetParamsException('You cannot set parameters directly in '.__CLASS__.'.');
134 134
     }
135 135
 
136 136
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $this->processor->post($this->url, $this->requestJson);
173 173
 
174
-        if(!$this->processor->error) {
174
+        if (!$this->processor->error) {
175 175
             return $this->processor->response;
176 176
         }
177 177
         $error_message = null;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $error_message = $this->processor->error_message;
181 181
             $error_code    = $this->processor->error_code;
182 182
         }
183
-        throw new AuthnetCurlException('Connection error: ' . $error_message . ' (' . $error_code . ')');
183
+        throw new AuthnetCurlException('Connection error: '.$error_message.' ('.$error_code.')');
184 184
     }
185 185
 
186 186
     /**
Please login to merge, or discard this patch.