Passed
Push — develop ( b1637b...512b2b )
by Reüel
05:41
created
gateways/MeprDirectDebitSofortGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitSofortGateway', 'MeprDirectDebitSofortGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitSofortGateway', 'MeprDirectDebitSofortGateway');
Please login to merge, or discard this patch.
gateways/MeprPronamicGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\Gateway', 'MeprPronamicGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\Gateway', 'MeprPronamicGateway');
Please login to merge, or discard this patch.
gateways/MeprBankTransferGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\BankTransferGateway', 'MeprBankTransferGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\BankTransferGateway', 'MeprBankTransferGateway');
Please login to merge, or discard this patch.
gateways/MeprDirectDebitIDealGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitIDealGateway', 'MeprDirectDebitIDealGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitIDealGateway', 'MeprDirectDebitIDealGateway');
Please login to merge, or discard this patch.
gateways/MeprIDealGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\IDealGateway', 'MeprIDealGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\IDealGateway', 'MeprIDealGateway');
Please login to merge, or discard this patch.
gateways/MeprMisterCashGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\BancontactGateway', 'MeprMisterCashGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\BancontactGateway', 'MeprMisterCashGateway');
Please login to merge, or discard this patch.
gateways/MeprPronamicPayPalGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9 9
  */
10 10
 
11
-class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\PayPalGateway', 'MeprPronamicPayPalGateway' );
11
+class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\PayPalGateway', 'MeprPronamicPayPalGateway');
Please login to merge, or discard this patch.
src/SubscriptionStatuses.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
 	 *
29 29
 	 * @param string $status MemberPress subscription status value.
30 30
 	 */
31
-	public static function transform( $status ) {
32
-		switch ( $status ) {
31
+	public static function transform($status) {
32
+		switch ($status) {
33 33
 			case MeprSubscription::$pending_str:
34 34
 				return Statuses::OPEN;
35 35
 			case MeprSubscription::$active_str:
Please login to merge, or discard this patch.
src/Extension.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function __construct() {
47 47
 		// @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprGatewayFactory.php#L48-50
48
-		add_filter( 'mepr-gateway-paths', array( $this, 'gateway_paths' ) );
48
+		add_filter('mepr-gateway-paths', array($this, 'gateway_paths'));
49 49
 
50
-		add_filter( 'pronamic_payment_redirect_url_' . self::SLUG, array( __CLASS__, 'redirect_url' ), 10, 2 );
51
-		add_action( 'pronamic_payment_status_update_' . self::SLUG, array( __CLASS__, 'status_update' ), 10, 1 );
50
+		add_filter('pronamic_payment_redirect_url_' . self::SLUG, array(__CLASS__, 'redirect_url'), 10, 2);
51
+		add_action('pronamic_payment_status_update_' . self::SLUG, array(__CLASS__, 'status_update'), 10, 1);
52 52
 
53
-		add_filter( 'pronamic_payment_source_text_' . self::SLUG, array( __CLASS__, 'source_text' ), 10, 2 );
54
-		add_filter( 'pronamic_payment_source_description_' . self::SLUG, array( __CLASS__, 'source_description' ), 10, 2 );
55
-		add_filter( 'pronamic_payment_source_url_' . self::SLUG, array( __CLASS__, 'source_url' ), 10, 2 );
56
-		add_filter( 'pronamic_subscription_source_text_' . self::SLUG, array( __CLASS__, 'subscription_source_text' ), 10, 2 );
57
-		add_filter( 'pronamic_subscription_source_description_' . self::SLUG, array( __CLASS__, 'subscription_source_description' ), 10, 2 );
53
+		add_filter('pronamic_payment_source_text_' . self::SLUG, array(__CLASS__, 'source_text'), 10, 2);
54
+		add_filter('pronamic_payment_source_description_' . self::SLUG, array(__CLASS__, 'source_description'), 10, 2);
55
+		add_filter('pronamic_payment_source_url_' . self::SLUG, array(__CLASS__, 'source_url'), 10, 2);
56
+		add_filter('pronamic_subscription_source_text_' . self::SLUG, array(__CLASS__, 'subscription_source_text'), 10, 2);
57
+		add_filter('pronamic_subscription_source_description_' . self::SLUG, array(__CLASS__, 'subscription_source_description'), 10, 2);
58 58
 
59
-		add_action( 'mepr_subscription_pre_delete', array( $this, 'subscription_pre_delete' ), 10, 1 );
59
+		add_action('mepr_subscription_pre_delete', array($this, 'subscription_pre_delete'), 10, 1);
60 60
 
61
-		add_action( 'mepr_subscription_transition_status', array( $this, 'memberpress_subscription_transition_status' ), 10, 3 );
61
+		add_action('mepr_subscription_transition_status', array($this, 'memberpress_subscription_transition_status'), 10, 3);
62 62
 	}
63 63
 
64 64
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 * @param array $paths Array with gateway paths.
70 70
 	 * @return array
71 71
 	 */
72
-	public function gateway_paths( $paths ) {
73
-		$paths[] = dirname( __FILE__ ) . '/../gateways/';
72
+	public function gateway_paths($paths) {
73
+		$paths[] = dirname(__FILE__) . '/../gateways/';
74 74
 
75 75
 		return $paths;
76 76
 	}
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return string
87 87
 	 */
88
-	public static function redirect_url( $url, Payment $payment ) {
88
+	public static function redirect_url($url, Payment $payment) {
89 89
 		global $transaction;
90 90
 
91 91
 		$transaction_id = $payment->get_source_id();
92 92
 
93
-		$transaction = new MeprTransaction( $transaction_id );
93
+		$transaction = new MeprTransaction($transaction_id);
94 94
 
95
-		switch ( $payment->get_status() ) {
95
+		switch ($payment->get_status()) {
96 96
 			case Statuses::CANCELLED:
97 97
 			case Statuses::EXPIRED:
98 98
 			case Statuses::FAILURE:
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 					array(
103 103
 						'action'   => 'payment_form',
104 104
 						'txn'      => $transaction->trans_num,
105
-						'_wpnonce' => wp_create_nonce( 'mepr_payment_form' ),
105
+						'_wpnonce' => wp_create_nonce('mepr_payment_form'),
106 106
 					),
107 107
 					$product->url()
108 108
 				);
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 				// @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782
113 113
 				$mepr_options = MeprOptions::fetch();
114 114
 
115
-				$product         = new MeprProduct( $transaction->product_id );
116
-				$sanitized_title = sanitize_title( $product->post_title );
115
+				$product         = new MeprProduct($transaction->product_id);
116
+				$sanitized_title = sanitize_title($product->post_title);
117 117
 
118 118
 				$args = array(
119 119
 					'membership_id' => $product->ID,
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 					'trans_num'     => $transaction->trans_num,
122 122
 				);
123 123
 
124
-				$url = $mepr_options->thankyou_page_url( http_build_query( $args ) );
124
+				$url = $mepr_options->thankyou_page_url(http_build_query($args));
125 125
 
126 126
 				break;
127 127
 			case Statuses::OPEN:
@@ -139,26 +139,26 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @param Payment $payment The payment whose status is updated.
141 141
 	 */
142
-	public static function status_update( Payment $payment ) {
142
+	public static function status_update(Payment $payment) {
143 143
 		$transaction_id = $payment->get_source_id();
144 144
 
145
-		$transaction = new MeprTransaction( $transaction_id );
145
+		$transaction = new MeprTransaction($transaction_id);
146 146
 
147
-		if ( $payment->get_recurring() ) {
147
+		if ($payment->get_recurring()) {
148 148
 			$subscription = $transaction->subscription();
149 149
 
150
-			if ( empty( $subscription ) || empty( $subscription->id ) ) {
150
+			if (empty($subscription) || empty($subscription->id)) {
151 151
 				$subscription_id = $payment->get_subscription()->get_source_id();
152 152
 
153
-				$subscription = new MeprSubscription( $subscription_id );
153
+				$subscription = new MeprSubscription($subscription_id);
154 154
 			}
155 155
 
156 156
 			// Same source ID and first transaction ID for recurring payment means we need to add a new transaction.
157
-			if ( $payment->get_source_id() === $subscription->id ) {
157
+			if ($payment->get_source_id() === $subscription->id) {
158 158
 				// First transaction.
159 159
 				$first_txn = $subscription->first_txn();
160 160
 
161
-				if ( false === $first_txn || ! ( $first_txn instanceof MeprTransaction ) ) {
161
+				if (false === $first_txn || ! ($first_txn instanceof MeprTransaction)) {
162 162
 					$first_txn             = new MeprTransaction();
163 163
 					$first_txn->user_id    = $subscription->user_id;
164 164
 					$first_txn->product_id = $subscription->product_id;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 				// Transaction number.
170 170
 				$trans_num = $payment->get_transaction_id();
171 171
 
172
-				if ( empty( $trans_num ) ) {
172
+				if (empty($trans_num)) {
173 173
 					$trans_num = uniqid();
174 174
 				}
175 175
 
@@ -185,28 +185,28 @@  discard block
 block discarded – undo
185 185
 				$transaction->status          = MeprTransaction::$pending_str;
186 186
 				$transaction->subscription_id = $subscription->id;
187 187
 
188
-				$transaction->set_gross( $payment->get_amount()->get_amount() );
188
+				$transaction->set_gross($payment->get_amount()->get_amount());
189 189
 
190 190
 				$transaction->store();
191 191
 
192 192
 				// Set source ID.
193
-				$payment->set_meta( 'source_id', $transaction->id );
193
+				$payment->set_meta('source_id', $transaction->id);
194 194
 
195 195
 				$payment->source_id = $transaction->id;
196 196
 			}
197 197
 		}
198 198
 
199
-		$should_update = ! MemberPress::transaction_has_status( $transaction, array(
199
+		$should_update = ! MemberPress::transaction_has_status($transaction, array(
200 200
 			MeprTransaction::$failed_str,
201 201
 			MeprTransaction::$complete_str,
202
-		) );
202
+		));
203 203
 
204
-		if ( $should_update ) {
204
+		if ($should_update) {
205 205
 			$gateway = new Gateway();
206 206
 
207 207
 			$gateway->mp_txn = $transaction;
208 208
 
209
-			switch ( $payment->get_status() ) {
209
+			switch ($payment->get_status()) {
210 210
 				case Statuses::CANCELLED:
211 211
 				case Statuses::EXPIRED:
212 212
 				case Statuses::FAILURE:
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 					break;
216 216
 				case Statuses::SUCCESS:
217
-					if ( $payment->get_recurring() ) {
217
+					if ($payment->get_recurring()) {
218 218
 						$gateway->record_subscription_payment();
219 219
 					} else {
220 220
 						$gateway->record_payment();
@@ -233,25 +233,25 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @param int $subscription_id MemberPress subscription id.
235 235
 	 */
236
-	public function subscription_pre_delete( $subscription_id ) {
237
-		$subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $subscription_id );
236
+	public function subscription_pre_delete($subscription_id) {
237
+		$subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $subscription_id);
238 238
 
239
-		if ( ! $subscription ) {
239
+		if ( ! $subscription) {
240 240
 			return;
241 241
 		}
242 242
 
243 243
 		// Add note.
244 244
 		$note = sprintf(
245 245
 			/* translators: %s: MemberPress */
246
-			__( '%s subscription deleted.', 'pronamic_ideal' ),
247
-			__( 'MemberPress', 'pronamic_ideal' )
246
+			__('%s subscription deleted.', 'pronamic_ideal'),
247
+			__('MemberPress', 'pronamic_ideal')
248 248
 		);
249 249
 
250
-		$subscription->add_note( $note );
250
+		$subscription->add_note($note);
251 251
 
252 252
 		// The status of canceled or completed subscriptions will not be changed automatically.
253
-		if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) {
254
-			$subscription->set_status( Statuses::CANCELLED );
253
+		if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) {
254
+			$subscription->set_status(Statuses::CANCELLED);
255 255
 
256 256
 			$subscription->save();
257 257
 		}
@@ -265,18 +265,18 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return string
267 267
 	 */
268
-	public static function source_text( $text, Payment $payment ) {
269
-		$text = __( 'MemberPress', 'pronamic_ideal' ) . '<br />';
268
+	public static function source_text($text, Payment $payment) {
269
+		$text = __('MemberPress', 'pronamic_ideal') . '<br />';
270 270
 
271 271
 		$text .= sprintf(
272 272
 			'<a href="%s">%s</a>',
273
-			add_query_arg( array(
273
+			add_query_arg(array(
274 274
 				'page'   => 'memberpress-trans',
275 275
 				'action' => 'edit',
276 276
 				'id'     => $payment->source_id,
277
-			), admin_url( 'admin.php' ) ),
277
+			), admin_url('admin.php')),
278 278
 			/* translators: %s: payment source id */
279
-			sprintf( __( 'Transaction %s', 'pronamic_ideal' ), $payment->source_id )
279
+			sprintf(__('Transaction %s', 'pronamic_ideal'), $payment->source_id)
280 280
 		);
281 281
 
282 282
 		return $text;
@@ -290,18 +290,18 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return string
292 292
 	 */
293
-	public static function subscription_source_text( $text, Subscription $subscription ) {
294
-		$text = __( 'MemberPress', 'pronamic_ideal' ) . '<br />';
293
+	public static function subscription_source_text($text, Subscription $subscription) {
294
+		$text = __('MemberPress', 'pronamic_ideal') . '<br />';
295 295
 
296 296
 		$text .= sprintf(
297 297
 			'<a href="%s">%s</a>',
298
-			add_query_arg( array(
298
+			add_query_arg(array(
299 299
 				'page'   => 'memberpress-trans',
300 300
 				'action' => 'subscription',
301 301
 				'id'     => $subscription->source_id,
302
-			), admin_url( 'admin.php' ) ),
302
+			), admin_url('admin.php')),
303 303
 			/* translators: %s: payment source id */
304
-			sprintf( __( 'Subscription %s', 'pronamic_ideal' ), $subscription->source_id )
304
+			sprintf(__('Subscription %s', 'pronamic_ideal'), $subscription->source_id)
305 305
 		);
306 306
 
307 307
 		return $text;
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return string
317 317
 	 */
318
-	public static function source_description( $description, Payment $payment ) {
319
-		return __( 'MemberPress Transaction', 'pronamic_ideal' );
318
+	public static function source_description($description, Payment $payment) {
319
+		return __('MemberPress Transaction', 'pronamic_ideal');
320 320
 	}
321 321
 
322 322
 	/**
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return string
329 329
 	 */
330
-	public static function subscription_source_description( $description, Subscription $subscription ) {
331
-		return __( 'MemberPress Subscription', 'pronamic_ideal' );
330
+	public static function subscription_source_description($description, Subscription $subscription) {
331
+		return __('MemberPress Subscription', 'pronamic_ideal');
332 332
 	}
333 333
 
334 334
 	/**
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return string
341 341
 	 */
342
-	public static function source_url( $url, Payment $payment ) {
343
-		$url = add_query_arg( array(
342
+	public static function source_url($url, Payment $payment) {
343
+		$url = add_query_arg(array(
344 344
 			'page'   => 'memberpress-trans',
345 345
 			'action' => 'edit',
346 346
 			'id'     => $payment->source_id,
347
-		), admin_url( 'admin.php' ) );
347
+		), admin_url('admin.php'));
348 348
 
349 349
 		return $url;
350 350
 	}
@@ -360,16 +360,16 @@  discard block
 block discarded – undo
360 360
 	 * @param string           $status_new               New status identifier.
361 361
 	 * @param MeprSubscription $memberpress_subscription MemberPress subscription object.
362 362
 	 */
363
-	public function memberpress_subscription_transition_status( $status_old, $status_new, $memberpress_subscription ) {
364
-		$subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $memberpress_subscription->id );
363
+	public function memberpress_subscription_transition_status($status_old, $status_new, $memberpress_subscription) {
364
+		$subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $memberpress_subscription->id);
365 365
 
366
-		if ( empty( $subscription ) ) {
366
+		if (empty($subscription)) {
367 367
 			return;
368 368
 		}
369 369
 
370
-		$status = SubscriptionStatuses::transform( $status_new );
370
+		$status = SubscriptionStatuses::transform($status_new);
371 371
 
372
-		$subscription->set_status( $status );
372
+		$subscription->set_status($status);
373 373
 
374 374
 		$subscription->save();
375 375
 	}
Please login to merge, or discard this patch.