@@ -17,6 +17,7 @@ |
||
17 | 17 | * Redefine the exception so message isn't optional |
18 | 18 | * |
19 | 19 | * @access public |
20 | + * @param string $message |
|
20 | 21 | * @return void |
21 | 22 | */ |
22 | 23 | public function __construct($message, $code = 0, Exception $previous = null) |
@@ -12,13 +12,13 @@ |
||
12 | 12 | class Exception extends \Exception |
13 | 13 | { |
14 | 14 | /** |
15 | - * __Construct function. |
|
16 | - * |
|
17 | - * Redefine the exception so message isn't optional |
|
18 | - * |
|
19 | - * @access public |
|
20 | - * @return void |
|
21 | - */ |
|
15 | + * __Construct function. |
|
16 | + * |
|
17 | + * Redefine the exception so message isn't optional |
|
18 | + * |
|
19 | + * @access public |
|
20 | + * @return void |
|
21 | + */ |
|
22 | 22 | public function __construct($message, $code = 0, Exception $previous = null) |
23 | 23 | { |
24 | 24 | // Make sure everything is assigned properly |
@@ -27,6 +27,7 @@ discard block |
||
27 | 27 | * Instantiates the object |
28 | 28 | * |
29 | 29 | * @access public |
30 | + * @param Client $client |
|
30 | 31 | * @return object |
31 | 32 | */ |
32 | 33 | public function __construct( $client ) |
@@ -68,6 +69,7 @@ discard block |
||
68 | 69 | * Performs an API POST request |
69 | 70 | * |
70 | 71 | * @access public |
72 | + * @param string $path |
|
71 | 73 | * @return Response |
72 | 74 | */ |
73 | 75 | public function post( $path, $form = array() ) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @access public |
30 | 30 | * @return object |
31 | 31 | */ |
32 | - public function __construct( $client ) |
|
32 | + public function __construct($client) |
|
33 | 33 | { |
34 | 34 | $this->client = $client; |
35 | 35 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * @param array $query |
45 | 45 | * @return Response |
46 | 46 | */ |
47 | - public function get( $path, $query = array() ) |
|
47 | + public function get($path, $query = array()) |
|
48 | 48 | { |
49 | 49 | // Add query parameters to $path? |
50 | 50 | if ($query) { |
51 | - if (strpos($path, '?') === false ) { |
|
51 | + if (strpos($path, '?') === false) { |
|
52 | 52 | $path .= '?' . http_build_query($query); |
53 | 53 | } else { |
54 | 54 | $path .= ini_get('arg_separator.output') . http_build_query($query); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @access public |
71 | 71 | * @return Response |
72 | 72 | */ |
73 | - public function post( $path, $form = array() ) |
|
73 | + public function post($path, $form = array()) |
|
74 | 74 | { |
75 | 75 | // Set the request params |
76 | 76 | $this->set_url($path); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @access public |
88 | 88 | * @return Response |
89 | 89 | */ |
90 | - public function put( $path, $form = array() ) |
|
90 | + public function put($path, $form = array()) |
|
91 | 91 | { |
92 | 92 | // Set the request params |
93 | 93 | $this->set_url($path); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @access public |
105 | 105 | * @return Response |
106 | 106 | */ |
107 | - public function patch( $path, $form = array() ) |
|
107 | + public function patch($path, $form = array()) |
|
108 | 108 | { |
109 | 109 | // Set the request params |
110 | 110 | $this->set_url($path); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @access public |
122 | 122 | * @return Response |
123 | 123 | */ |
124 | - public function delete( $path, $form = array() ) |
|
124 | + public function delete($path, $form = array()) |
|
125 | 125 | { |
126 | 126 | // Set the request params |
127 | 127 | $this->set_url($path); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @access protected |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - protected function set_url( $params ) |
|
141 | + protected function set_url($params) |
|
142 | 142 | { |
143 | 143 | curl_setopt($this->client->ch, CURLOPT_URL, Constants::API_URL . trim($params, '/')); |
144 | 144 | } |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * @param array $form |
154 | 154 | * @return Response |
155 | 155 | */ |
156 | - protected function execute( $request_type, $form = array() ) |
|
156 | + protected function execute($request_type, $form = array()) |
|
157 | 157 | { |
158 | 158 | // Set the HTTP request type |
159 | 159 | curl_setopt($this->client->ch, CURLOPT_CUSTOMREQUEST, $request_type); |
160 | 160 | |
161 | 161 | // If additional data is delivered, we will send it along with the API request |
162 | - if (is_array($form) && ! empty($form)) { |
|
162 | + if (is_array($form) && !empty($form)) { |
|
163 | 163 | curl_setopt($this->client->ch, CURLOPT_POSTFIELDS, http_build_query($form)); |
164 | 164 | } |
165 | 165 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | throw new Exception($this->testMessage, $this->testCode); |
17 | 17 | } |
18 | - catch(Exception $e) |
|
18 | + catch (Exception $e) |
|
19 | 19 | { |
20 | 20 | $this->assertEquals($e->getMessage(), $this->testMessage); |
21 | 21 | $this->assertEquals($e->getCode(), $this->testCode); |
@@ -14,8 +14,7 @@ |
||
14 | 14 | try |
15 | 15 | { |
16 | 16 | throw new Exception($this->testMessage, $this->testCode); |
17 | - } |
|
18 | - catch(Exception $e) |
|
17 | + } catch(Exception $e) |
|
19 | 18 | { |
20 | 19 | $this->assertEquals($e->getMessage(), $this->testMessage); |
21 | 20 | $this->assertEquals($e->getCode(), $this->testCode); |
@@ -21,13 +21,13 @@ |
||
21 | 21 | |
22 | 22 | |
23 | 23 | /** |
24 | - * __construct function. |
|
25 | - * |
|
26 | - * Instantiates the main class. |
|
27 | - * Creates a client which is passed to the request construct. |
|
28 | - * |
|
29 | - * @access public |
|
30 | - */ |
|
24 | + * __construct function. |
|
25 | + * |
|
26 | + * Instantiates the main class. |
|
27 | + * Creates a client which is passed to the request construct. |
|
28 | + * |
|
29 | + * @access public |
|
30 | + */ |
|
31 | 31 | public function __construct( $auth_string = '' ) |
32 | 32 | { |
33 | 33 | $client = new Client($auth_string); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @access public |
30 | 30 | */ |
31 | - public function __construct( $auth_string = '' ) |
|
31 | + public function __construct($auth_string = '') |
|
32 | 32 | { |
33 | 33 | $client = new Client($auth_string); |
34 | 34 | $this->request = new Request($client); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace QuickPay\API; |
3 | 3 | /** |
4 | - * @class QuickPay_Client |
|
5 | - * @since 1.0.0 |
|
6 | - * @package QuickPay |
|
7 | - * @category Class |
|
8 | - * @author Patrick Tolvstein, Perfect Solution ApS |
|
9 | - * @docs http://tech.quickpay.net/api/ |
|
10 | - */ |
|
4 | + * @class QuickPay_Client |
|
5 | + * @since 1.0.0 |
|
6 | + * @package QuickPay |
|
7 | + * @category Class |
|
8 | + * @author Patrick Tolvstein, Perfect Solution ApS |
|
9 | + * @docs http://tech.quickpay.net/api/ |
|
10 | + */ |
|
11 | 11 | class Client |
12 | 12 | { |
13 | 13 | /** |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @access public |
33 | 33 | */ |
34 | - public function __construct( $auth_string = '' ) |
|
34 | + public function __construct($auth_string = '') |
|
35 | 35 | { |
36 | 36 | // Check if lib cURL is enabled |
37 | - if (!function_exists('curl_init') ) { |
|
37 | + if (!function_exists('curl_init')) { |
|
38 | 38 | throw new Exception('Lib cURL must be enabled on the server'); |
39 | 39 | } |
40 | 40 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function shutdown() |
56 | 56 | { |
57 | - if (!empty($this->ch) ) { |
|
57 | + if (!empty($this->ch)) { |
|
58 | 58 | curl_close($this->ch); |
59 | 59 | } |
60 | 60 | } |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace QuickPay\API; |
3 | 3 | /** |
4 | - * @class QuickPay_Response |
|
5 | - * @since 1.0.0 |
|
6 | - * @package QuickPay |
|
7 | - * @category Class |
|
8 | - * @author Patrick Tolvstein, Perfect Solution ApS |
|
9 | - * @docs http://tech.quickpay.net/api/ |
|
10 | - */ |
|
4 | + * @class QuickPay_Response |
|
5 | + * @since 1.0.0 |
|
6 | + * @package QuickPay |
|
7 | + * @category Class |
|
8 | + * @author Patrick Tolvstein, Perfect Solution ApS |
|
9 | + * @docs http://tech.quickpay.net/api/ |
|
10 | + */ |
|
11 | 11 | class Response |
12 | 12 | { |
13 | 13 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return [ |
86 | 86 | $this->status_code, |
87 | 87 | ['sent' => $sent_headers, |
88 | - 'received' => $this->received_headers, |
|
88 | + 'received' => $this->received_headers, |
|
89 | 89 | ], |
90 | 90 | $this->response_data, |
91 | 91 | ]; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $received_headers the headers received |
49 | 49 | * @param string $response_data the http response body |
50 | 50 | */ |
51 | - public function __construct( $status_code, $sent_headers, $received_headers, $response_data ) |
|
51 | + public function __construct($status_code, $sent_headers, $received_headers, $response_data) |
|
52 | 52 | { |
53 | 53 | $this->status_code = $status_code; |
54 | 54 | $this->sent_headers = $sent_headers; |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * @param boolan $keep_authorization_value Normally the value of the Authorization: header is masked. True keeps the sent value. |
67 | 67 | * @return array [integer, string[], string] |
68 | 68 | */ |
69 | - public function as_raw( $keep_authorization_value = false ) |
|
69 | + public function as_raw($keep_authorization_value = false) |
|
70 | 70 | { |
71 | 71 | // To avoid unintentional logging of credentials the default is to mask the value of the Authorization: header |
72 | - if ($keep_authorization_value ) { |
|
72 | + if ($keep_authorization_value) { |
|
73 | 73 | $sent_headers = $this->sent_headers; |
74 | 74 | } else { |
75 | 75 | // Avoid dependency on mbstring |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function as_array() |
102 | 102 | { |
103 | - if ($response = json_decode($this->response_data, true) ) { |
|
103 | + if ($response = json_decode($this->response_data, true)) { |
|
104 | 104 | return $response; |
105 | 105 | } |
106 | 106 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function as_object() |
118 | 118 | { |
119 | - if ($response = json_decode($this->response_data) ) { |
|
119 | + if ($response = json_decode($this->response_data)) { |
|
120 | 120 | return $response; |
121 | 121 | } |
122 | 122 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function is_success() |
146 | 146 | { |
147 | - if ($this->status_code > 299 ) { |
|
147 | + if ($this->status_code > 299) { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace QuickPay\API; |
3 | 3 | /** |
4 | - * @class QuickPay_Constants |
|
5 | - * @since 1.0.0 |
|
6 | - * @package QuickPay |
|
7 | - * @category Class |
|
8 | - * @author Patrick Tolvstein, Perfect Solution ApS |
|
9 | - * @docs http://tech.quickpay.net/api/ |
|
10 | - */ |
|
4 | + * @class QuickPay_Constants |
|
5 | + * @since 1.0.0 |
|
6 | + * @package QuickPay |
|
7 | + * @category Class |
|
8 | + * @author Patrick Tolvstein, Perfect Solution ApS |
|
9 | + * @docs http://tech.quickpay.net/api/ |
|
10 | + */ |
|
11 | 11 | class Constants |
12 | 12 | { |
13 | 13 | /** |