Passed
Push — master ( b8e26c...2f113f )
by Remco
05:42
created
src/Address.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@
 block discarded – undo
114 114
 			'countryCode'         => $this->country_code,
115 115
 		);
116 116
 
117
-		$data = array_filter( $data );
117
+		$data = array_filter($data);
118 118
 
119
-		if ( empty( $data ) ) {
119
+		if (empty($data)) {
120 120
 			return null;
121 121
 		}
122 122
 
Please login to merge, or discard this patch.
src/ConfigFactory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@
 block discarded – undo
26 26
 	 * @param string $post_id Post ID.
27 27
 	 * @return Config
28 28
 	 */
29
-	public function get_config( $post_id ) {
29
+	public function get_config($post_id) {
30 30
 		$config = new Config();
31 31
 
32 32
 		$config->post_id                  = $post_id;
33
-		$config->mode                     = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
34
-		$config->refresh_token            = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_refresh_token', true );
35
-		$config->signing_key              = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_signing_key', true );
36
-		$config->access_token             = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_access_token', true );
37
-		$config->access_token_valid_until = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', true );
38
-		$config->order_id                 = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_order_id', true );
33
+		$config->mode                     = get_post_meta($post_id, '_pronamic_gateway_mode', true);
34
+		$config->refresh_token            = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_refresh_token', true);
35
+		$config->signing_key              = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_signing_key', true);
36
+		$config->access_token             = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_access_token', true);
37
+		$config->access_token_valid_until = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', true);
38
+		$config->order_id                 = get_post_meta($post_id, '_pronamic_gateway_omnikassa_2_order_id', true);
39 39
 
40 40
 		return $config;
41 41
 	}
Please login to merge, or discard this patch.
src/Gateway.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param \Pronamic\WordPress\Pay\Gateways\OmniKassa2\Config $config Config.
30 30
 	 */
31
-	public function __construct( Config $config ) {
32
-		parent::__construct( $config );
31
+	public function __construct(Config $config) {
32
+		parent::__construct($config);
33 33
 
34
-		$this->set_method( self::METHOD_HTTP_REDIRECT );
35
-		$this->set_has_feedback( true );
36
-		$this->set_amount_minimum( 0.01 );
34
+		$this->set_method(self::METHOD_HTTP_REDIRECT);
35
+		$this->set_has_feedback(true);
36
+		$this->set_amount_minimum(0.01);
37 37
 
38 38
 		// Client.
39 39
 		$this->client = new Client();
40 40
 
41 41
 		$url = Client::URL_PRODUCTION;
42 42
 
43
-		if ( self::MODE_TEST === $config->mode ) {
43
+		if (self::MODE_TEST === $config->mode) {
44 44
 			$url = Client::URL_SANDBOX;
45 45
 		}
46 46
 
47
-		$this->client->set_url( $url );
48
-		$this->client->set_refresh_token( $config->refresh_token );
49
-		$this->client->set_signing_key( $config->signing_key );
47
+		$this->client->set_url($url);
48
+		$this->client->set_refresh_token($config->refresh_token);
49
+		$this->client->set_signing_key($config->signing_key);
50 50
 	}
51 51
 
52 52
 	/**
@@ -71,39 +71,39 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param Payment $payment Payment.
73 73
 	 */
74
-	public function start( Payment $payment ) {
75
-		$merchant_order_id = $payment->format_string( $this->config->order_id );
74
+	public function start(Payment $payment) {
75
+		$merchant_order_id = $payment->format_string($this->config->order_id);
76 76
 
77
-		$payment->set_meta( 'omnikassa_2_merchant_order_id', $merchant_order_id );
77
+		$payment->set_meta('omnikassa_2_merchant_order_id', $merchant_order_id);
78 78
 
79 79
 		$amount = new Money(
80 80
 			$payment->get_currency(),
81
-			Core_Util::amount_to_cents( $payment->get_amount()->get_amount() )
81
+			Core_Util::amount_to_cents($payment->get_amount()->get_amount())
82 82
 		);
83 83
 
84 84
 		$merchant_return_url = $payment->get_return_url();
85 85
 
86
-		$order = new Order( $merchant_order_id, $amount, $merchant_return_url );
86
+		$order = new Order($merchant_order_id, $amount, $merchant_return_url);
87 87
 
88
-		$order->set_description( $payment->get_description() );
89
-		$order->set_language( $payment->get_language() );
88
+		$order->set_description($payment->get_description());
89
+		$order->set_language($payment->get_language());
90 90
 
91 91
 		// Payment brand.
92
-		$payment_brand = PaymentBrands::transform( $payment->get_method() );
92
+		$payment_brand = PaymentBrands::transform($payment->get_method());
93 93
 
94
-		$order->set_payment_brand( $payment_brand );
94
+		$order->set_payment_brand($payment_brand);
95 95
 
96
-		if ( null !== $payment_brand ) {
96
+		if (null !== $payment_brand) {
97 97
 			// Payment brand force should only be set if payment brand is not empty.
98
-			$order->set_payment_brand_force( PaymentBrandForce::FORCE_ONCE );
98
+			$order->set_payment_brand_force(PaymentBrandForce::FORCE_ONCE);
99 99
 		}
100 100
 
101
-		if ( ! $this->config->is_access_token_valid() ) {
101
+		if ( ! $this->config->is_access_token_valid()) {
102 102
 			$data = $this->client->get_access_token_data();
103 103
 
104 104
 			$error = $this->client->get_error();
105 105
 
106
-			if ( is_wp_error( $error ) ) {
106
+			if (is_wp_error($error)) {
107 107
 				$this->error = $error;
108 108
 
109 109
 				return;
@@ -112,22 +112,22 @@  discard block
 block discarded – undo
112 112
 			$this->config->access_token             = $data->token;
113 113
 			$this->config->access_token_valid_until = $data->validUntil;
114 114
 
115
-			update_post_meta( $this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token', $data->token );
116
-			update_post_meta( $this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', $data->validUntil );
115
+			update_post_meta($this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token', $data->token);
116
+			update_post_meta($this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', $data->validUntil);
117 117
 		}
118 118
 
119
-		$result = $this->client->order_announce( $this->config, $order );
119
+		$result = $this->client->order_announce($this->config, $order);
120 120
 
121 121
 		$error = $this->client->get_error();
122 122
 
123
-		if ( is_wp_error( $error ) ) {
123
+		if (is_wp_error($error)) {
124 124
 			$this->error = $error;
125 125
 
126 126
 			return;
127 127
 		}
128 128
 
129
-		if ( $result ) {
130
-			$payment->set_action_url( $result->redirectUrl );
129
+		if ($result) {
130
+			$payment->set_action_url($result->redirectUrl);
131 131
 		}
132 132
 	}
133 133
 
@@ -136,45 +136,45 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @param Payment $payment Payment.
138 138
 	 */
139
-	public function update_status( Payment $payment ) {
140
-		if ( ! ReturnParameters::contains( $_GET ) ) { // WPCS: CSRF ok.
139
+	public function update_status(Payment $payment) {
140
+		if ( ! ReturnParameters::contains($_GET)) { // WPCS: CSRF ok.
141 141
 			return;
142 142
 		}
143 143
 
144
-		$parameters = ReturnParameters::from_array( $_GET ); // WPCS: CSRF ok.
144
+		$parameters = ReturnParameters::from_array($_GET); // WPCS: CSRF ok.
145 145
 
146 146
 		// Note.
147 147
 		$note_values = array(
148 148
 			'order_id'  => $parameters->get_order_id(),
149 149
 			'status'    => $parameters->get_status(),
150 150
 			'signature' => $parameters->get_signature(),
151
-			'valid'     => $parameters->is_valid( $this->config->signing_key ) ? 'true' : 'false',
151
+			'valid'     => $parameters->is_valid($this->config->signing_key) ? 'true' : 'false',
152 152
 		);
153 153
 
154 154
 		$note = '';
155 155
 
156 156
 		$note .= '<p>';
157
-		$note .= __( 'OmniKassa 2.0 return URL requested:', 'pronamic_ideal' );
157
+		$note .= __('OmniKassa 2.0 return URL requested:', 'pronamic_ideal');
158 158
 		$note .= '</p>';
159 159
 
160 160
 		$note .= '<dl>';
161 161
 
162
-		foreach ( $note_values as $key => $value ) {
163
-			$note .= sprintf( '<dt>%s</dt>', esc_html( $key ) );
164
-			$note .= sprintf( '<dd>%s</dd>', esc_html( $value ) );
162
+		foreach ($note_values as $key => $value) {
163
+			$note .= sprintf('<dt>%s</dt>', esc_html($key));
164
+			$note .= sprintf('<dd>%s</dd>', esc_html($value));
165 165
 		}
166 166
 
167 167
 		$note .= '</dl>';
168 168
 
169
-		$payment->add_note( $note );
169
+		$payment->add_note($note);
170 170
 
171 171
 		// Validate.
172
-		if ( ! $parameters->is_valid( $this->config->signing_key ) ) {
172
+		if ( ! $parameters->is_valid($this->config->signing_key)) {
173 173
 			return;
174 174
 		}
175 175
 
176 176
 		// Status.
177
-		$payment->set_status( Statuses::transform( $parameters->get_status() ) );
177
+		$payment->set_status(Statuses::transform($parameters->get_status()));
178 178
 	}
179 179
 
180 180
 	/**
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @param Notification $notification Notification.
184 184
 	 */
185
-	public function handle_notification( Notification $notification ) {
186
-		if ( ! $notification->is_valid( $this->config->signing_key ) ) {
185
+	public function handle_notification(Notification $notification) {
186
+		if ( ! $notification->is_valid($this->config->signing_key)) {
187 187
 			return;
188 188
 		}
189 189
 
190
-		switch ( $notification->get_event_name() ) {
190
+		switch ($notification->get_event_name()) {
191 191
 			case 'merchant.order.status.changed':
192
-				return $this->handle_merchant_order_staus_changed( $notification );
192
+				return $this->handle_merchant_order_staus_changed($notification);
193 193
 		}
194 194
 	}
195 195
 
@@ -198,38 +198,38 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @param Notification $notification Notification.
200 200
 	 */
201
-	private function handle_merchant_order_staus_changed( Notification $notification ) {
201
+	private function handle_merchant_order_staus_changed(Notification $notification) {
202 202
 		do {
203
-			$order_results = $this->client->get_order_results( $notification->get_authentication() );
203
+			$order_results = $this->client->get_order_results($notification->get_authentication());
204 204
 
205
-			if ( ! $order_results->is_valid( $this->config->signing_key ) ) {
205
+			if ( ! $order_results->is_valid($this->config->signing_key)) {
206 206
 				return;
207 207
 			}
208 208
 
209
-			foreach ( $order_results as $order_result ) {
210
-				$payment = get_pronamic_payment_by_meta( '_pronamic_payment_omnikassa_2_merchant_order_id', $order_result->get_merchant_order_id() );
209
+			foreach ($order_results as $order_result) {
210
+				$payment = get_pronamic_payment_by_meta('_pronamic_payment_omnikassa_2_merchant_order_id', $order_result->get_merchant_order_id());
211 211
 
212
-				if ( empty( $payment ) ) {
212
+				if (empty($payment)) {
213 213
 					continue;
214 214
 				}
215 215
 
216
-				$payment->set_transaction_id( $order_result->get_omnikassa_order_id() );
217
-				$payment->set_status( Statuses::transform( $order_result->get_order_status() ) );
216
+				$payment->set_transaction_id($order_result->get_omnikassa_order_id());
217
+				$payment->set_status(Statuses::transform($order_result->get_order_status()));
218 218
 
219 219
 				// Note.
220 220
 				$note = '';
221 221
 
222 222
 				$note .= '<p>';
223
-				$note .= __( 'OmniKassa 2.0 webhook URL requested:', 'pronamic_ideal' );
223
+				$note .= __('OmniKassa 2.0 webhook URL requested:', 'pronamic_ideal');
224 224
 				$note .= '</p>';
225 225
 				$note .= '<pre>';
226
-				$note .= wp_json_encode( $order_result->get_json(), JSON_PRETTY_PRINT );
226
+				$note .= wp_json_encode($order_result->get_json(), JSON_PRETTY_PRINT);
227 227
 				$note .= '</pre>';
228 228
 
229
-				$payment->add_note( $note );
229
+				$payment->add_note($note);
230 230
 
231 231
 				$payment->save();
232 232
 			}
233
-		} while ( $order_results->more_available() );
233
+		} while ($order_results->more_available());
234 234
 	}
235 235
 }
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 * Constructs and initialize settings.
25 25
 	 */
26 26
 	public function __construct() {
27
-		add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
28
-		add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) );
27
+		add_filter('pronamic_pay_gateway_sections', array($this, 'sections'));
28
+		add_filter('pronamic_pay_gateway_fields', array($this, 'fields'));
29 29
 	}
30 30
 
31 31
 	/**
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
 	 * @param array $sections Sections.
35 35
 	 * @return array
36 36
 	 */
37
-	public function sections( array $sections ) {
37
+	public function sections(array $sections) {
38 38
 		$sections['omnikassa-2'] = array(
39
-			'title'   => __( 'OmniKassa 2.0', 'pronamic_ideal' ),
40
-			'methods' => array( 'omnikassa-2' ),
39
+			'title'   => __('OmniKassa 2.0', 'pronamic_ideal'),
40
+			'methods' => array('omnikassa-2'),
41 41
 		);
42 42
 
43 43
 		// Advanced.
44 44
 		$sections['omnikassa-2_advanced'] = array(
45
-			'title'   => __( 'Advanced', 'pronamic_ideal' ),
46
-			'methods' => array( 'omnikassa-2' ),
45
+			'title'   => __('Advanced', 'pronamic_ideal'),
46
+			'methods' => array('omnikassa-2'),
47 47
 		);
48 48
 
49 49
 		// Transaction feedback.
50 50
 		$sections['omnikassa-2_feedback'] = array(
51
-			'title'       => __( 'Transaction feedback', 'pronamic_ideal' ),
52
-			'methods'     => array( 'omnikassa-2' ),
51
+			'title'       => __('Transaction feedback', 'pronamic_ideal'),
52
+			'methods'     => array('omnikassa-2'),
53 53
 			'description' => sprintf(
54 54
 				/* translators: %s: OmniKassa 2 */
55
-				__( 'Set the Webhook URL in the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ),
56
-				__( 'OmniKassa 2.0', 'pronamic_ideal' )
55
+				__('Set the Webhook URL in the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal'),
56
+				__('OmniKassa 2.0', 'pronamic_ideal')
57 57
 			),
58 58
 		);
59 59
 
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
 	 * @param array $fields Fields.
67 67
 	 * @return array
68 68
 	 */
69
-	public function fields( array $fields ) {
69
+	public function fields(array $fields) {
70 70
 		// Refresh Token.
71 71
 		$fields[] = array(
72 72
 			'filter'   => FILTER_SANITIZE_STRING,
73 73
 			'section'  => 'omnikassa-2',
74 74
 			'meta_key' => '_pronamic_gateway_omnikassa_2_refresh_token',
75
-			'title'    => _x( 'Refresh Token', 'omnikassa', 'pronamic_ideal' ),
75
+			'title'    => _x('Refresh Token', 'omnikassa', 'pronamic_ideal'),
76 76
 			'type'     => 'textarea',
77
-			'classes'  => array( 'code' ),
77
+			'classes'  => array('code'),
78 78
 		);
79 79
 
80 80
 		// Signing Key.
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 			'filter'   => FILTER_SANITIZE_STRING,
83 83
 			'section'  => 'omnikassa-2',
84 84
 			'meta_key' => '_pronamic_gateway_omnikassa_2_signing_key',
85
-			'title'    => _x( 'Signing Key', 'omnikassa', 'pronamic_ideal' ),
85
+			'title'    => _x('Signing Key', 'omnikassa', 'pronamic_ideal'),
86 86
 			'type'     => 'text',
87
-			'classes'  => array( 'large-text', 'code' ),
87
+			'classes'  => array('large-text', 'code'),
88 88
 		);
89 89
 
90 90
 		// Transaction feedback.
91 91
 		$fields[] = array(
92 92
 			'section' => 'omnikassa-2',
93
-			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
93
+			'title'   => __('Transaction feedback', 'pronamic_ideal'),
94 94
 			'type'    => 'description',
95 95
 			'html'    => sprintf(
96 96
 				'<span class="dashicons dashicons-warning"></span> %s',
97
-				__( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' )
97
+				__('Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal')
98 98
 			),
99 99
 		);
100 100
 
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
 			'filter'      => FILTER_SANITIZE_STRING,
104 104
 			'section'     => 'omnikassa-2_advanced',
105 105
 			'meta_key'    => '_pronamic_gateway_omnikassa_2_order_id',
106
-			'title'       => __( 'Order ID', 'pronamic_ideal' ),
106
+			'title'       => __('Order ID', 'pronamic_ideal'),
107 107
 			'type'        => 'text',
108
-			'classes'     => array( 'regular-text', 'code' ),
108
+			'classes'     => array('regular-text', 'code'),
109 109
 			'tooltip'     => sprintf(
110 110
 				/* translators: %s: Parameter */
111
-				__( 'The OmniKassa %s parameter.', 'pronamic_ideal' ),
112
-				sprintf( '<code>%s</code>', 'orderId' )
111
+				__('The OmniKassa %s parameter.', 'pronamic_ideal'),
112
+				sprintf('<code>%s</code>', 'orderId')
113 113
 			),
114 114
 			'description' => sprintf(
115 115
 				'%s %s<br />%s',
116
-				__( 'Available tags:', 'pronamic_ideal' ),
116
+				__('Available tags:', 'pronamic_ideal'),
117 117
 				sprintf(
118 118
 					'<code>%s</code> <code>%s</code>',
119 119
 					'{order_id}',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				),
122 122
 				sprintf(
123 123
 					/* translators: %s: {payment_id} */
124
-					__( 'Default: <code>%s</code>', 'pronamic_ideal' ),
124
+					__('Default: <code>%s</code>', 'pronamic_ideal'),
125 125
 					'{payment_id}'
126 126
 				)
127 127
 			),
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 		// Webhook.
131 131
 		$fields[] = array(
132 132
 			'section'  => 'omnikassa-2_feedback',
133
-			'title'    => __( 'Webhook URL', 'pronamic_ideal' ),
133
+			'title'    => __('Webhook URL', 'pronamic_ideal'),
134 134
 			'type'     => 'text',
135
-			'classes'  => array( 'large-text', 'code' ),
136
-			'value'    => add_query_arg( 'omnikassa2_webhook', '', home_url( '/' ) ),
135
+			'classes'  => array('large-text', 'code'),
136
+			'value'    => add_query_arg('omnikassa2_webhook', '', home_url('/')),
137 137
 			'readonly' => true,
138
-			'methods'  => array( 'omnikassa-2' ),
139
-			'tooltip'  => __( 'The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ),
138
+			'methods'  => array('omnikassa-2'),
139
+			'tooltip'  => __('The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal'),
140 140
 		);
141 141
 
142 142
 		return $fields;
Please login to merge, or discard this patch.
src/Order.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @param Money  $amount               Amount.
152 152
 	 * @param string $merchant_return_url  Merchant return URL.
153 153
 	 */
154
-	public function __construct( $merchant_order_id, $amount, $merchant_return_url ) {
155
-		$this->timestamp           = date( DATE_ATOM );
154
+	public function __construct($merchant_order_id, $amount, $merchant_return_url) {
155
+		$this->timestamp           = date(DATE_ATOM);
156 156
 		$this->merchant_order_id   = $merchant_order_id;
157 157
 		$this->amount              = $amount;
158 158
 		$this->merchant_return_url = $merchant_return_url;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @param string $description Description.
165 165
 	 */
166
-	public function set_description( $description ) {
166
+	public function set_description($description) {
167 167
 		$this->description = $description;
168 168
 	}
169 169
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @param string $language Language.
174 174
 	 */
175
-	public function set_language( $language ) {
175
+	public function set_language($language) {
176 176
 		$this->language = $language;
177 177
 	}
178 178
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @param string $payment_brand Payment brand.
183 183
 	 */
184
-	public function set_payment_brand( $payment_brand ) {
184
+	public function set_payment_brand($payment_brand) {
185 185
 		$this->payment_brand = $payment_brand;
186 186
 	}
187 187
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @param string $payment_brand_force Payment brand force.
192 192
 	 */
193
-	public function set_payment_brand_force( $payment_brand_force ) {
193
+	public function set_payment_brand_force($payment_brand_force) {
194 194
 		$this->payment_brand_force = $payment_brand_force;
195 195
 	}
196 196
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 		);
238 238
 
239 239
 		// Remove empty optional fields.
240
-		$optional = array_filter( $optional );
240
+		$optional = array_filter($optional);
241 241
 
242
-		return array_merge( $fields, $optional );
242
+		return array_merge($fields, $optional);
243 243
 	}
244 244
 }
Please login to merge, or discard this patch.
src/CustomerInformation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param string $email_address E-mailadress of the consumer.
66 66
 	 */
67
-	public function set_email_address( $email_address ) {
67
+	public function set_email_address($email_address) {
68 68
 		$this->email_address = $email_address;
69 69
 	}
70 70
 
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 			'telephoneNumber' => $this->telephoneNumber,
83 83
 		);
84 84
 
85
-		$data = array_filter( $data );
85
+		$data = array_filter($data);
86 86
 
87
-		if ( empty( $data ) ) {
87
+		if (empty($data)) {
88 88
 			return null;
89 89
 		}
90 90
 
Please login to merge, or discard this patch.
src/Statuses.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
 	 * @param string $status OmniKassa 2.0 status.
55 55
 	 * @return string|null
56 56
 	 */
57
-	public static function transform( $status ) {
58
-		switch ( $status ) {
57
+	public static function transform($status) {
58
+		switch ($status) {
59 59
 			case self::CANCELLED:
60 60
 				return Core_Statuses::CANCELLED;
61 61
 			case self::COMPLETED:
Please login to merge, or discard this patch.
src/Security.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 	 * @param string   $signing_key Signing Key.
26 26
 	 * @return string|null
27 27
 	 */
28
-	public static function get_signature( Signable $signable, $signing_key ) {
28
+	public static function get_signature(Signable $signable, $signing_key) {
29 29
 		$data = $signable->get_signature_data();
30 30
 
31
-		if ( empty( $data ) ) {
31
+		if (empty($data)) {
32 32
 			return;
33 33
 		}
34 34
 
35
-		if ( empty( $signing_key ) ) {
35
+		if (empty($signing_key)) {
36 36
 			return;
37 37
 		}
38 38
 
39 39
 		$signature = hash_hmac(
40 40
 			'sha512',
41
-			implode( ',', $data ),
42
-			base64_decode( $signing_key )
41
+			implode(',', $data),
42
+			base64_decode($signing_key)
43 43
 		);
44 44
 
45 45
 		return $signature;
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	 * @param string $signature_b Signature B.
53 53
 	 * @return bool True if valid, false otherwise.
54 54
 	 */
55
-	public static function validate_signature( $signature_a, $signature_b ) {
56
-		if ( empty( $signature_a ) || empty( $signature_b ) ) {
55
+	public static function validate_signature($signature_a, $signature_b) {
56
+		if (empty($signature_a) || empty($signature_b)) {
57 57
 			// Empty signature string or null from calculation.
58 58
 			return false;
59 59
 		}
60 60
 
61
-		return ( 0 === strcasecmp( $signature_a, $signature_b ) );
61
+		return (0 === strcasecmp($signature_a, $signature_b));
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string $url URL.
73 73
 	 */
74
-	public function set_url( $url ) {
74
+	public function set_url($url) {
75 75
 		$this->url = $url;
76 76
 	}
77 77
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param string $refresh_token Refresh token.
91 91
 	 */
92
-	public function set_refresh_token( $refresh_token ) {
92
+	public function set_refresh_token($refresh_token) {
93 93
 		$this->refresh_token = $refresh_token;
94 94
 	}
95 95
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @param string $signing_key Signing key.
109 109
 	 */
110
-	public function set_signing_key( $signing_key ) {
110
+	public function set_signing_key($signing_key) {
111 111
 		$this->signing_key = $signing_key;
112 112
 	}
113 113
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string      $token    Authorization token.
120 120
 	 * @param object|null $object   Object.
121 121
 	 */
122
-	private function request( $method, $endpoint, $token, $object = null ) {
122
+	private function request($method, $endpoint, $token, $object = null) {
123 123
 		// URL.
124 124
 		$url = $this->get_url() . $endpoint;
125 125
 
@@ -131,45 +131,45 @@  discard block
 block discarded – undo
131 131
 			),
132 132
 		);
133 133
 
134
-		if ( null !== $object ) {
134
+		if (null !== $object) {
135 135
 			$args['headers']['Content-Type'] = 'application/json';
136 136
 
137
-			$args['body'] = wp_json_encode( $object );
137
+			$args['body'] = wp_json_encode($object);
138 138
 		}
139 139
 
140 140
 		// Request.
141
-		$response = wp_remote_request( $url, $args );
141
+		$response = wp_remote_request($url, $args);
142 142
 
143
-		if ( is_wp_error( $response ) ) {
143
+		if (is_wp_error($response)) {
144 144
 			$this->error = $response;
145 145
 
146
-			$this->error->add( 'omnikassa_2_error', 'HTTP Request Failed' );
146
+			$this->error->add('omnikassa_2_error', 'HTTP Request Failed');
147 147
 
148 148
 			return false;
149 149
 		}
150 150
 
151 151
 		// Body.
152
-		$body = wp_remote_retrieve_body( $response );
152
+		$body = wp_remote_retrieve_body($response);
153 153
 
154
-		$data = json_decode( $body );
154
+		$data = json_decode($body);
155 155
 
156
-		if ( ! is_object( $data ) ) {
157
-			$this->error = new \WP_Error( 'omnikassa_2_error', 'Could not parse response.', $data );
156
+		if ( ! is_object($data)) {
157
+			$this->error = new \WP_Error('omnikassa_2_error', 'Could not parse response.', $data);
158 158
 
159 159
 			return false;
160 160
 		}
161 161
 
162 162
 		// Error.
163
-		if ( isset( $data->errorCode ) ) {
163
+		if (isset($data->errorCode)) {
164 164
 			$message = 'Unknown error.';
165 165
 
166
-			if ( isset( $data->consumerMessage ) ) {
166
+			if (isset($data->consumerMessage)) {
167 167
 				$message = $data->consumerMessage;
168
-			} elseif ( isset( $data->errorMessage ) ) {
168
+			} elseif (isset($data->errorMessage)) {
169 169
 				$message = $data->errorMessage;
170 170
 			}
171 171
 
172
-			$this->error = new \WP_Error( 'omnikassa_2_error', $message, $data );
172
+			$this->error = new \WP_Error('omnikassa_2_error', $message, $data);
173 173
 
174 174
 			return false;
175 175
 		}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 * @return string
185 185
 	 */
186 186
 	public function get_access_token_data() {
187
-		return $this->request( 'GET', 'gatekeeper/refresh', $this->get_refresh_token() );
187
+		return $this->request('GET', 'gatekeeper/refresh', $this->get_refresh_token());
188 188
 	}
189 189
 
190 190
 	/**
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 	 * @param Order  $order  Order.
195 195
 	 * @return object|bool
196 196
 	 */
197
-	public function order_announce( $config, Order $order ) {
197
+	public function order_announce($config, Order $order) {
198 198
 		$object = $order->get_json();
199 199
 
200
-		$object->signature = Security::get_signature( $order, $config->signing_key );
200
+		$object->signature = Security::get_signature($order, $config->signing_key);
201 201
 
202
-		return $this->request( 'POST', 'order/server/api/order', $config->access_token, $object );
202
+		return $this->request('POST', 'order/server/api/order', $config->access_token, $object);
203 203
 	}
204 204
 
205 205
 	/**
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	 * @param string $notification_token Notification token.
209 209
 	 * @return OrderResults
210 210
 	 */
211
-	public function get_order_results( $notification_token ) {
212
-		$result = $this->request( 'GET', 'order/server/api/events/results/merchant.order.status.changed', $notification_token );
211
+	public function get_order_results($notification_token) {
212
+		$result = $this->request('GET', 'order/server/api/events/results/merchant.order.status.changed', $notification_token);
213 213
 
214
-		return OrderResults::from_object( $result );
214
+		return OrderResults::from_object($result);
215 215
 	}
216 216
 }
Please login to merge, or discard this patch.