Passed
Push — develop ( 3200c7...243503 )
by Remco
04:05
created
src/PaymentData.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @param MeprTransaction $txn MemberPress transaction object.
56 56
 	 */
57
-	public function __construct( MeprTransaction $transaction ) {
57
+	public function __construct(MeprTransaction $transaction) {
58 58
 		parent::__construct();
59 59
 
60 60
 		$this->transaction = $transaction;
61 61
 		$this->member      = $transaction->user();
62
-		$this->recurring   = ( $transaction->subscription() && $transaction->subscription()->txn_count > 1 );
62
+		$this->recurring   = ($transaction->subscription() && $transaction->subscription()->txn_count > 1);
63 63
 	}
64 64
 
65 65
 	/**
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 		$items = new Items();
118 118
 
119 119
 		$item = new Item();
120
-		$item->setNumber( $this->get_order_id() );
121
-		$item->setDescription( $this->get_description() );
122
-		$item->setPrice( $this->transaction->total );
123
-		$item->setQuantity( 1 );
120
+		$item->setNumber($this->get_order_id());
121
+		$item->setDescription($this->get_description());
122
+		$item->setPrice($this->transaction->total);
123
+		$item->setQuantity(1);
124 124
 
125
-		$items->addItem( $item );
125
+		$items->addItem($item);
126 126
 
127 127
 		return $items;
128 128
 	}
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 * @return string|null
199 199
 	 */
200 200
 	public function get_address() {
201
-		$value = $this->member->address( 'one', false );
201
+		$value = $this->member->address('one', false);
202 202
 
203
-		if ( false === $value ) {
203
+		if (false === $value) {
204 204
 			return null;
205 205
 		}
206 206
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 * @return string|null
216 216
 	 */
217 217
 	public function get_city() {
218
-		$value = $this->member->address( 'city', false );
218
+		$value = $this->member->address('city', false);
219 219
 
220
-		if ( false === $value ) {
220
+		if (false === $value) {
221 221
 			return null;
222 222
 		}
223 223
 
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 	 * @return string|null
233 233
 	 */
234 234
 	public function get_zip() {
235
-		$value = $this->member->address( 'zip', false );
235
+		$value = $this->member->address('zip', false);
236 236
 
237
-		if ( false === $value ) {
237
+		if (false === $value) {
238 238
 			return null;
239 239
 		}
240 240
 
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 	 * @return string|null
250 250
 	 */
251 251
 	public function get_country() {
252
-		$value = $this->member->address( 'country', false );
252
+		$value = $this->member->address('country', false);
253 253
 
254
-		if ( false === $value ) {
254
+		if (false === $value) {
255 255
 			return null;
256 256
 		}
257 257
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		$mepr_options = MeprOptions::fetch();
270 270
 
271 271
 		// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782
272
-		return $mepr_options->thankyou_page_url( 'trans_num=' . $this->transaction->id );
272
+		return $mepr_options->thankyou_page_url('trans_num=' . $this->transaction->id);
273 273
 	}
274 274
 
275 275
 	/**
@@ -309,36 +309,36 @@  discard block
 block discarded – undo
309 309
 	public function get_subscription() {
310 310
 		$product = $this->transaction->product();
311 311
 
312
-		if ( $product->is_one_time_payment() ) {
312
+		if ($product->is_one_time_payment()) {
313 313
 			return false;
314 314
 		}
315 315
 
316 316
 		$mp_subscription = $this->transaction->subscription();
317 317
 
318
-		if ( ! $mp_subscription ) {
318
+		if ( ! $mp_subscription) {
319 319
 			return false;
320 320
 		}
321 321
 
322 322
 		$frequency = '';
323 323
 
324
-		if ( $mp_subscription->limit_cycles ) {
324
+		if ($mp_subscription->limit_cycles) {
325 325
 			$frequency = $mp_subscription->limit_cycles;
326 326
 		}
327 327
 
328 328
 		$subscription                  = new Subscription();
329 329
 		$subscription->frequency       = $frequency;
330 330
 		$subscription->interval        = $product->period;
331
-		$subscription->interval_period = Core_Util::to_period( $product->period_type );
331
+		$subscription->interval_period = Core_Util::to_period($product->period_type);
332 332
 		$subscription->description     = sprintf(
333 333
 			'Order #%s - %s',
334 334
 			$this->get_source_id(),
335 335
 			$this->get_description()
336 336
 		);
337 337
 
338
-		$subscription->set_amount( new Money(
338
+		$subscription->set_amount(new Money(
339 339
 			$this->transaction->total,
340 340
 			$this->get_currency_alphabetic_code()
341
-		) );
341
+		));
342 342
 
343 343
 		return $subscription;
344 344
 	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	public function get_subscription_source_id() {
353 353
 		$subscription = $this->get_subscription();
354 354
 
355
-		if ( ! $subscription ) {
355
+		if ( ! $subscription) {
356 356
 			return false;
357 357
 		}
358 358
 
Please login to merge, or discard this patch.