Test Failed
Push — feature/post-pay ( 5683cc...70df55 )
by Remco
03:39
created
src/Request.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 * @param string      $merchant_id    Merchant ID.
38 38
 	 * @param string|null $shop_id        Shop ID.
39 39
 	 */
40
-	public function __construct( $merchant_id, $shop_id = null ) {
41
-		$this->set_parameter( 'merchantid', $merchant_id );
42
-		$this->set_parameter( 'shopid', $shop_id );
40
+	public function __construct($merchant_id, $shop_id = null) {
41
+		$this->set_parameter('merchantid', $merchant_id);
42
+		$this->set_parameter('shopid', $shop_id);
43 43
 	}
44 44
 
45 45
 	/**
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * @param string $parameter Parameter.
49 49
 	 * @return string|null
50 50
 	 */
51
-	public function get_parameter( $parameter ) {
52
-		if ( isset( $this->parameters[ $parameter ] ) ) {
53
-			return $this->parameters[ $parameter ];
51
+	public function get_parameter($parameter) {
52
+		if (isset($this->parameters[$parameter])) {
53
+			return $this->parameters[$parameter];
54 54
 		}
55 55
 
56 56
 		return null;
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param string $parameter Parameter.
63 63
 	 * @param string $value     Value.
64 64
 	 */
65
-	public function set_parameter( $parameter, $value ) {
66
-		$this->parameters[ $parameter ] = $value;
65
+	public function set_parameter($parameter, $value) {
66
+		$this->parameters[$parameter] = $value;
67 67
 	}
68 68
 
69 69
 	/**
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param array $parameters Parameters.
82 82
 	 */
83
-	public function merge_parameters( $parameters ) {
84
-		$this->parameters = array_merge( $this->parameters, $parameters );
83
+	public function merge_parameters($parameters) {
84
+		$this->parameters = array_merge($this->parameters, $parameters);
85 85
 	}
86 86
 
87 87
 	/**
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 	 * @param string $merchant_key Merchant key.
100 100
 	 * @return string
101 101
 	 */
102
-	public function get_signature( $merchant_key ) {
102
+	public function get_signature($merchant_key) {
103 103
 		$data = $this->get_signature_data();
104 104
 
105 105
 		$data[] = $merchant_key;
106 106
 
107
-		$string = implode( '', $data );
107
+		$string = implode('', $data);
108 108
 
109
-		$signature = sha1( $string );
109
+		$signature = sha1($string);
110 110
 
111 111
 		return $signature;
112 112
 	}
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param string $merchant_key Merchant key.
118 118
 	 */
119
-	public function sign( $merchant_key ) {
120
-		$signature = $this->get_signature( $merchant_key );
119
+	public function sign($merchant_key) {
120
+		$signature = $this->get_signature($merchant_key);
121 121
 
122
-		$this->set_parameter( 'sha1', $signature );
122
+		$this->set_parameter('sha1', $signature);
123 123
 	}
124 124
 }
Please login to merge, or discard this patch.
src/StatusRequest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 	 * @param string      $merchant_id    Merchant ID.
29 29
 	 * @param string|null $shop_id        Shop ID.
30 30
 	 */
31
-	public function __construct( $transaction_id, $merhant_id, $shop_id = null ) {
32
-		parent::__construct( $merhant_id, $shop_id );
31
+	public function __construct($transaction_id, $merhant_id, $shop_id = null) {
32
+		parent::__construct($merhant_id, $shop_id);
33 33
 
34
-		$this->set_parameter( 'trxid', $transaction_id );
34
+		$this->set_parameter('trxid', $transaction_id);
35 35
 	}
36 36
 
37 37
 	/**
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function get_signature_data() {
43 43
 		return array(
44
-			$this->get_parameter( 'trxid' ),
44
+			$this->get_parameter('trxid'),
45 45
 
46 46
 			/*
47 47
 			 * Indien er geen gebruik wordt gemaakt van de shopid dan kunt u deze weglaten uit de berekening.
48 48
 			 */
49
-			$this->get_parameter( 'shopid' ),
49
+			$this->get_parameter('shopid'),
50 50
 
51
-			$this->get_parameter( 'merchantid' ),
51
+			$this->get_parameter('merchantid'),
52 52
 
53
-			$this->get_parameter( 'merchantkey' ),
53
+			$this->get_parameter('merchantkey'),
54 54
 		);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param string $merchant_id  Merchant ID.
69 69
 	 * @param string $merchant_key Merchant key.
70 70
 	 */
71
-	public function __construct( $merchant_id, $merchant_key ) {
71
+	public function __construct($merchant_id, $merchant_key) {
72 72
 		$this->merchant_id  = $merchant_id;
73 73
 		$this->merchant_key = $merchant_key;
74 74
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @param boolean $test_mode True if test mode, false otherwise.
89 89
 	 */
90
-	public function set_test_mode( $test_mode ) {
90
+	public function set_test_mode($test_mode) {
91 91
 		$this->test_mode = $test_mode;
92 92
 	}
93 93
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param array  $parameters Parameters.
99 99
 	 * @return string|WP_Error|array
100 100
 	 */
101
-	private function send_request( $method, array $parameters = array() ) {
101
+	private function send_request($method, array $parameters = array()) {
102 102
 		$url = self::API_URL . '/' . $method;
103 103
 
104 104
 		return Core_Util::remote_get_body(
@@ -117,31 +117,31 @@  discard block
 block discarded – undo
117 117
 	 * @param SimpleXMLElement $document Document.
118 118
 	 * @return WP_Error|Transaction|Error
119 119
 	 */
120
-	private function parse_document( SimpleXMLElement $document ) {
120
+	private function parse_document(SimpleXMLElement $document) {
121 121
 		$this->error = null;
122 122
 
123 123
 		$name = $document->getName();
124 124
 
125
-		switch ( $name ) {
125
+		switch ($name) {
126 126
 			case 'errorresponse':
127
-				$sisow_error = ErrorParser::parse( $document->error );
127
+				$sisow_error = ErrorParser::parse($document->error);
128 128
 
129
-				$this->error = new WP_Error( 'ideal_sisow_error', $sisow_error->message, $sisow_error );
129
+				$this->error = new WP_Error('ideal_sisow_error', $sisow_error->message, $sisow_error);
130 130
 
131 131
 				return $sisow_error;
132 132
 			case 'transactionrequest':
133
-				$transaction = TransactionParser::parse( $document->transaction );
133
+				$transaction = TransactionParser::parse($document->transaction);
134 134
 
135 135
 				return $transaction;
136 136
 			case 'statusresponse':
137
-				$transaction = TransactionParser::parse( $document->transaction );
137
+				$transaction = TransactionParser::parse($document->transaction);
138 138
 
139 139
 				return $transaction;
140 140
 			default:
141 141
 				return new WP_Error(
142 142
 					'ideal_sisow_error',
143 143
 					/* translators: %s: XML document element name */
144
-					sprintf( __( 'Unknwon Sisow message (%s)', 'pronamic_ideal' ), $name )
144
+					sprintf(__('Unknwon Sisow message (%s)', 'pronamic_ideal'), $name)
145 145
 				);
146 146
 		}
147 147
 	}
@@ -154,36 +154,36 @@  discard block
 block discarded – undo
154 154
 	public function get_directory() {
155 155
 		$directory = false;
156 156
 
157
-		if ( $this->test_mode ) {
158
-			$directory = array( '99' => __( 'Sisow Bank (test)', 'pronamic_ideal' ) );
157
+		if ($this->test_mode) {
158
+			$directory = array('99' => __('Sisow Bank (test)', 'pronamic_ideal'));
159 159
 		} else {
160 160
 			// Request.
161
-			$result = $this->send_request( RequestMethods::DIRECTORY_REQUEST );
161
+			$result = $this->send_request(RequestMethods::DIRECTORY_REQUEST);
162 162
 
163
-			if ( $result instanceof WP_Error ) {
163
+			if ($result instanceof WP_Error) {
164 164
 				$this->error = $result;
165 165
 
166 166
 				return $directory;
167 167
 			}
168 168
 
169 169
 			// XML.
170
-			$xml = Core_Util::simplexml_load_string( $result );
170
+			$xml = Core_Util::simplexml_load_string($result);
171 171
 
172
-			if ( $xml instanceof WP_Error ) {
172
+			if ($xml instanceof WP_Error) {
173 173
 				$this->error = $xml;
174 174
 
175 175
 				return $directory;
176 176
 			}
177 177
 
178 178
 			// Parse.
179
-			if ( $xml instanceof SimpleXMLElement ) {
179
+			if ($xml instanceof SimpleXMLElement) {
180 180
 				$directory = array();
181 181
 
182
-				foreach ( $xml->directory->issuer as $issuer ) {
182
+				foreach ($xml->directory->issuer as $issuer) {
183 183
 					$id   = (string) $issuer->issuerid;
184 184
 					$name = (string) $issuer->issuername;
185 185
 
186
-					$directory[ $id ] = $name;
186
+					$directory[$id] = $name;
187 187
 				}
188 188
 			}
189 189
 		}
@@ -197,34 +197,34 @@  discard block
 block discarded – undo
197 197
 	 * @param TransactionRequest $request Transaction request.
198 198
 	 * @return Transaction|false
199 199
 	 */
200
-	public function create_transaction( TransactionRequest $request ) {
200
+	public function create_transaction(TransactionRequest $request) {
201 201
 		$result = false;
202 202
 
203 203
 		// Request.
204
-		$request->sign( $this->merchant_key );
204
+		$request->sign($this->merchant_key);
205 205
 
206
-		$response = $this->send_request( RequestMethods::TRANSACTION_REQUEST, $request->get_parameters() );
206
+		$response = $this->send_request(RequestMethods::TRANSACTION_REQUEST, $request->get_parameters());
207 207
 
208
-		if ( $response instanceof WP_Error ) {
208
+		if ($response instanceof WP_Error) {
209 209
 			$this->error = $response;
210 210
 
211 211
 			return $result;
212 212
 		}
213 213
 
214 214
 		// XML.
215
-		$xml = Core_Util::simplexml_load_string( $response );
215
+		$xml = Core_Util::simplexml_load_string($response);
216 216
 
217
-		if ( $xml instanceof WP_Error ) {
217
+		if ($xml instanceof WP_Error) {
218 218
 			$this->error = $xml;
219 219
 
220 220
 			return $result;
221 221
 		}
222 222
 
223 223
 		// Parse.
224
-		if ( $xml instanceof SimpleXMLElement ) {
225
-			$message = $this->parse_document( $xml );
224
+		if ($xml instanceof SimpleXMLElement) {
225
+			$message = $this->parse_document($xml);
226 226
 
227
-			if ( $message instanceof Transaction ) {
227
+			if ($message instanceof Transaction) {
228 228
 				$result = $message;
229 229
 			}
230 230
 		}
@@ -238,32 +238,32 @@  discard block
 block discarded – undo
238 238
 	 * @param StatusRequest $request Status request object.
239 239
 	 * @return Transaction|Error|false
240 240
 	 */
241
-	public function get_status( StatusRequest $request ) {
241
+	public function get_status(StatusRequest $request) {
242 242
 		$status = false;
243 243
 
244 244
 		// Request.
245
-		$request->sign( $this->merchant_key );
245
+		$request->sign($this->merchant_key);
246 246
 
247
-		$result = $this->send_request( RequestMethods::STATUS_REQUEST, $request->get_parameters() );
247
+		$result = $this->send_request(RequestMethods::STATUS_REQUEST, $request->get_parameters());
248 248
 
249
-		if ( $result instanceof WP_Error ) {
249
+		if ($result instanceof WP_Error) {
250 250
 			$this->error = $result;
251 251
 
252 252
 			return $status;
253 253
 		}
254 254
 
255 255
 		// XML.
256
-		$xml = Core_Util::simplexml_load_string( $result );
256
+		$xml = Core_Util::simplexml_load_string($result);
257 257
 
258
-		if ( $xml instanceof WP_Error ) {
258
+		if ($xml instanceof WP_Error) {
259 259
 			$this->error = $xml;
260 260
 
261 261
 			return $status;
262 262
 		}
263 263
 
264 264
 		// Parse.
265
-		if ( $xml instanceof SimpleXMLElement ) {
266
-			$status = $this->parse_document( $xml );
265
+		if ($xml instanceof SimpleXMLElement) {
266
+			$status = $this->parse_document($xml);
267 267
 
268 268
 			return $status;
269 269
 		}
Please login to merge, or discard this patch.