Passed
Push — master ( 4d7f46...f00b0d )
by Brian
04:46
created
includes/class-wpinv-invoice.php 1 patch
Spacing   +780 added lines, -780 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Invoice class.
@@ -143,40 +143,40 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
145 145
 	 */
146
-    public function __construct( $invoice = 0 ) {
146
+    public function __construct($invoice = 0) {
147 147
 
148
-        parent::__construct( $invoice );
148
+        parent::__construct($invoice);
149 149
 
150
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
151
-			$this->set_id( (int) $invoice );
152
-		} elseif ( $invoice instanceof self ) {
153
-			$this->set_id( $invoice->get_id() );
154
-		} elseif ( ! empty( $invoice->ID ) ) {
155
-			$this->set_id( $invoice->ID );
156
-		} elseif ( is_array( $invoice ) ) {
157
-			$this->set_props( $invoice );
150
+		if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) {
151
+			$this->set_id((int) $invoice);
152
+		} elseif ($invoice instanceof self) {
153
+			$this->set_id($invoice->get_id());
154
+		} elseif (!empty($invoice->ID)) {
155
+			$this->set_id($invoice->ID);
156
+		} elseif (is_array($invoice)) {
157
+			$this->set_props($invoice);
158 158
 
159
-			if ( isset( $invoice['ID'] ) ) {
160
-				$this->set_id( $invoice['ID'] );
159
+			if (isset($invoice['ID'])) {
160
+				$this->set_id($invoice['ID']);
161 161
 			}
162 162
 
163
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
164
-			$this->set_id( $invoice_id );
165
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
166
-			$this->set_id( $invoice_id );
167
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
168
-			$this->set_id( $invoice_id );
163
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) {
164
+			$this->set_id($invoice_id);
165
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) {
166
+			$this->set_id($invoice_id);
167
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) {
168
+			$this->set_id($invoice_id);
169 169
 		} else {
170
-			$this->set_object_read( true );
170
+			$this->set_object_read(true);
171 171
 		}
172 172
 
173 173
         // Load the datastore.
174
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
174
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
175 175
 
176
-		if ( $this->get_id() > 0 ) {
177
-            $this->post = get_post( $this->get_id() );
176
+		if ($this->get_id() > 0) {
177
+            $this->post = get_post($this->get_id());
178 178
             $this->ID   = $this->get_id();
179
-			$this->data_store->read( $this );
179
+			$this->data_store->read($this);
180 180
         }
181 181
 
182 182
     }
@@ -191,38 +191,38 @@  discard block
 block discarded – undo
191 191
 	 * @since 1.0.15
192 192
 	 * @return int
193 193
 	 */
194
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
194
+	public static function get_invoice_id_by_field($value, $field = 'key') {
195 195
         global $wpdb;
196 196
 
197 197
 		// Trim the value.
198
-		$value = trim( $value );
198
+		$value = trim($value);
199 199
 
200
-		if ( empty( $value ) ) {
200
+		if (empty($value)) {
201 201
 			return 0;
202 202
 		}
203 203
 
204 204
         // Valid fields.
205
-        $fields = array( 'key', 'number', 'transaction_id' );
205
+        $fields = array('key', 'number', 'transaction_id');
206 206
 
207 207
 		// Ensure a field has been passed.
208
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
208
+		if (empty($field) || !in_array($field, $fields)) {
209 209
 			return 0;
210 210
 		}
211 211
 
212 212
 		// Maybe retrieve from the cache.
213
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
214
-		if ( false !== $invoice_id ) {
213
+		$invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids");
214
+		if (false !== $invoice_id) {
215 215
 			return $invoice_id;
216 216
 		}
217 217
 
218 218
         // Fetch from the db.
219 219
         $table       = $wpdb->prefix . 'getpaid_invoices';
220 220
         $invoice_id  = (int) $wpdb->get_var(
221
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
221
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value)
222 222
         );
223 223
 
224 224
 		// Update the cache with our data
225
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
225
+		wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids");
226 226
 
227 227
 		return $invoice_id;
228 228
     }
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
     /**
231 231
      * Checks if an invoice key is set.
232 232
      */
233
-    public function _isset( $key ) {
234
-        return isset( $this->data[$key] ) || method_exists( $this, "get_$key" );
233
+    public function _isset($key) {
234
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
235 235
     }
236 236
 
237 237
     /*
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 * @param  string $context View or edit context.
257 257
 	 * @return int
258 258
 	 */
259
-	public function get_parent_id( $context = 'view' ) {
260
-		return (int) $this->get_prop( 'parent_id', $context );
259
+	public function get_parent_id($context = 'view') {
260
+		return (int) $this->get_prop('parent_id', $context);
261 261
     }
262 262
 
263 263
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @return WPInv_Invoice
268 268
 	 */
269 269
     public function get_parent_payment() {
270
-        return new WPInv_Invoice( $this->get_parent_id() );
270
+        return new WPInv_Invoice($this->get_parent_id());
271 271
     }
272 272
 
273 273
     /**
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param  string $context View or edit context.
288 288
 	 * @return string
289 289
 	 */
290
-	public function get_status( $context = 'view' ) {
291
-		return $this->get_prop( 'status', $context );
290
+	public function get_status($context = 'view') {
291
+		return $this->get_prop('status', $context);
292 292
 	}
293 293
 	
294 294
 	/**
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @return array
299 299
 	 */
300 300
 	public function get_all_statuses() {
301
-		return wpinv_get_invoice_statuses( true, true, $this );
301
+		return wpinv_get_invoice_statuses(true, true, $this);
302 302
     }
303 303
 
304 304
     /**
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
     public function get_status_nicename() {
311 311
 		$statuses = $this->get_all_statuses();
312 312
 
313
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
313
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
314 314
 
315
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
315
+        return apply_filters('wpinv_get_invoice_status_nicename', $status, $this);
316 316
     }
317 317
 
318 318
 	/**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public function get_status_class() {
325 325
 		$statuses = getpaid_get_invoice_status_classes();
326
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
326
+		return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'badge-dark';
327 327
 	}
328 328
 
329 329
 	/**
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
      */
335 335
     public function get_status_label_html() {
336 336
 
337
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
338
-		$status       = sanitize_html_class( $this->get_status() );
339
-		$class        = esc_attr( $this->get_status_class() );
337
+		$status_label = sanitize_text_field($this->get_status_nicename());
338
+		$status       = sanitize_html_class($this->get_status());
339
+		$class        = esc_attr($this->get_status_class());
340 340
 
341 341
 		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
342 342
 	}
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 * @param  string $context View or edit context.
349 349
 	 * @return string
350 350
 	 */
351
-	public function get_version( $context = 'view' ) {
352
-		return $this->get_prop( 'version', $context );
351
+	public function get_version($context = 'view') {
352
+		return $this->get_prop('version', $context);
353 353
 	}
354 354
 
355 355
 	/**
356 356
 	 * @deprecated
357 357
 	 */
358
-	public function get_invoice_date( $format = true ) {
359
-		$date      = getpaid_format_date( $this->get_date_completed() );
360
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
361
-		$formatted = getpaid_format_date( $date );
358
+	public function get_invoice_date($format = true) {
359
+		$date      = getpaid_format_date($this->get_date_completed());
360
+		$date      = empty($date) ? $this->get_date_created() : $this->get_date_completed();
361
+		$formatted = getpaid_format_date($date);
362 362
 
363
-		if ( $format ) {
363
+		if ($format) {
364 364
 			return $formatted;
365 365
 		}
366 366
 
367
-		return empty( $formatted ) ? '' : $date;
367
+		return empty($formatted) ? '' : $date;
368 368
 
369 369
     }
370 370
 
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 	 * @param  string $context View or edit context.
376 376
 	 * @return string
377 377
 	 */
378
-	public function get_date_created( $context = 'view' ) {
379
-		return $this->get_prop( 'date_created', $context );
378
+	public function get_date_created($context = 'view') {
379
+		return $this->get_prop('date_created', $context);
380 380
 	}
381 381
 	
382 382
 	/**
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 	 * @param  string $context View or edit context.
387 387
 	 * @return string
388 388
 	 */
389
-	public function get_created_date( $context = 'view' ) {
390
-		return $this->get_date_created( $context );
389
+	public function get_created_date($context = 'view') {
390
+		return $this->get_date_created($context);
391 391
     }
392 392
 
393 393
     /**
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 	 * @param  string $context View or edit context.
398 398
 	 * @return string
399 399
 	 */
400
-	public function get_date_created_gmt( $context = 'view' ) {
401
-        $date = $this->get_date_created( $context );
400
+	public function get_date_created_gmt($context = 'view') {
401
+        $date = $this->get_date_created($context);
402 402
 
403
-        if ( $date ) {
404
-            $date = get_gmt_from_date( $date );
403
+        if ($date) {
404
+            $date = get_gmt_from_date($date);
405 405
         }
406 406
 		return $date;
407 407
     }
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * @param  string $context View or edit context.
414 414
 	 * @return string
415 415
 	 */
416
-	public function get_date_modified( $context = 'view' ) {
417
-		return $this->get_prop( 'date_modified', $context );
416
+	public function get_date_modified($context = 'view') {
417
+		return $this->get_prop('date_modified', $context);
418 418
 	}
419 419
 
420 420
 	/**
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 * @param  string $context View or edit context.
425 425
 	 * @return string
426 426
 	 */
427
-	public function get_modified_date( $context = 'view' ) {
428
-		return $this->get_date_modified( $context );
427
+	public function get_modified_date($context = 'view') {
428
+		return $this->get_date_modified($context);
429 429
     }
430 430
 
431 431
     /**
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
 	 * @param  string $context View or edit context.
436 436
 	 * @return string
437 437
 	 */
438
-	public function get_date_modified_gmt( $context = 'view' ) {
439
-        $date = $this->get_date_modified( $context );
438
+	public function get_date_modified_gmt($context = 'view') {
439
+        $date = $this->get_date_modified($context);
440 440
 
441
-        if ( $date ) {
442
-            $date = get_gmt_from_date( $date );
441
+        if ($date) {
442
+            $date = get_gmt_from_date($date);
443 443
         }
444 444
 		return $date;
445 445
     }
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 	 * @param  string $context View or edit context.
452 452
 	 * @return string
453 453
 	 */
454
-	public function get_due_date( $context = 'view' ) {
455
-		return $this->get_prop( 'due_date', $context );
454
+	public function get_due_date($context = 'view') {
455
+		return $this->get_prop('due_date', $context);
456 456
     }
457 457
 
458 458
     /**
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 	 * @param  string $context View or edit context.
463 463
 	 * @return string
464 464
 	 */
465
-	public function get_date_due( $context = 'view' ) {
466
-		return $this->get_due_date( $context );
465
+	public function get_date_due($context = 'view') {
466
+		return $this->get_due_date($context);
467 467
     }
468 468
 
469 469
     /**
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 	 * @param  string $context View or edit context.
474 474
 	 * @return string
475 475
 	 */
476
-	public function get_due_date_gmt( $context = 'view' ) {
477
-        $date = $this->get_due_date( $context );
476
+	public function get_due_date_gmt($context = 'view') {
477
+        $date = $this->get_due_date($context);
478 478
 
479
-        if ( $date ) {
480
-            $date = get_gmt_from_date( $date );
479
+        if ($date) {
480
+            $date = get_gmt_from_date($date);
481 481
         }
482 482
 		return $date;
483 483
     }
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 	 * @param  string $context View or edit context.
490 490
 	 * @return string
491 491
 	 */
492
-	public function get_gmt_date_due( $context = 'view' ) {
493
-		return $this->get_due_date_gmt( $context );
492
+	public function get_gmt_date_due($context = 'view') {
493
+		return $this->get_due_date_gmt($context);
494 494
     }
495 495
 
496 496
     /**
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param  string $context View or edit context.
501 501
 	 * @return string
502 502
 	 */
503
-	public function get_completed_date( $context = 'view' ) {
504
-		return $this->get_prop( 'completed_date', $context );
503
+	public function get_completed_date($context = 'view') {
504
+		return $this->get_prop('completed_date', $context);
505 505
     }
506 506
 
507 507
     /**
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 	 * @param  string $context View or edit context.
512 512
 	 * @return string
513 513
 	 */
514
-	public function get_date_completed( $context = 'view' ) {
515
-		return $this->get_completed_date( $context );
514
+	public function get_date_completed($context = 'view') {
515
+		return $this->get_completed_date($context);
516 516
     }
517 517
 
518 518
     /**
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
 	 * @param  string $context View or edit context.
523 523
 	 * @return string
524 524
 	 */
525
-	public function get_completed_date_gmt( $context = 'view' ) {
526
-        $date = $this->get_completed_date( $context );
525
+	public function get_completed_date_gmt($context = 'view') {
526
+        $date = $this->get_completed_date($context);
527 527
 
528
-        if ( $date ) {
529
-            $date = get_gmt_from_date( $date );
528
+        if ($date) {
529
+            $date = get_gmt_from_date($date);
530 530
         }
531 531
 		return $date;
532 532
     }
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 	 * @param  string $context View or edit context.
539 539
 	 * @return string
540 540
 	 */
541
-	public function get_gmt_completed_date( $context = 'view' ) {
542
-		return $this->get_completed_date_gmt( $context );
541
+	public function get_gmt_completed_date($context = 'view') {
542
+		return $this->get_completed_date_gmt($context);
543 543
     }
544 544
 
545 545
     /**
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
 	 * @param  string $context View or edit context.
550 550
 	 * @return string
551 551
 	 */
552
-	public function get_number( $context = 'view' ) {
553
-		$number = $this->get_prop( 'number', $context );
552
+	public function get_number($context = 'view') {
553
+		$number = $this->get_prop('number', $context);
554 554
 
555
-		if ( empty( $number ) ) {
555
+		if (empty($number)) {
556 556
 			$number = $this->generate_number();
557
-			$this->set_number( $this->generate_number() );
557
+			$this->set_number($this->generate_number());
558 558
 		}
559 559
 
560 560
 		return $number;
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 	public function maybe_set_number() {
569 569
         $number = $this->get_number();
570 570
 
571
-        if ( empty( $number ) || $this->get_id() == $number ) {
572
-			$this->set_number( $this->generate_number() );
571
+        if (empty($number) || $this->get_id() == $number) {
572
+			$this->set_number($this->generate_number());
573 573
         }
574 574
 
575 575
 	}
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	 * @param  string $context View or edit context.
582 582
 	 * @return string
583 583
 	 */
584
-	public function get_key( $context = 'view' ) {
585
-        return $this->get_prop( 'key', $context );
584
+	public function get_key($context = 'view') {
585
+        return $this->get_prop('key', $context);
586 586
 	}
587 587
 
588 588
 	/**
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
 	public function maybe_set_key() {
594 594
         $key = $this->get_key();
595 595
 
596
-        if ( empty( $key ) ) {
597
-            $key = $this->generate_key( $this->get_type() . '_' );
598
-            $this->set_key( $key );
596
+        if (empty($key)) {
597
+            $key = $this->generate_key($this->get_type() . '_');
598
+            $this->set_key($key);
599 599
         }
600 600
 
601 601
     }
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @param  string $context View or edit context.
608 608
 	 * @return string
609 609
 	 */
610
-	public function get_type( $context = 'view' ) {
611
-        return $this->get_prop( 'type', $context );
610
+	public function get_type($context = 'view') {
611
+        return $this->get_prop('type', $context);
612 612
 	}
613 613
 
614 614
 	/**
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @return string
619 619
 	 */
620 620
 	public function get_invoice_quote_type() {
621
-        return getpaid_get_post_type_label( $this->get_post_type(), false );
621
+        return getpaid_get_post_type_label($this->get_post_type(), false);
622 622
     }
623 623
 
624 624
     /**
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 * @param  string $context View or edit context.
629 629
 	 * @return string
630 630
 	 */
631
-	public function get_label( $context = 'view' ) {
632
-        return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
631
+	public function get_label($context = 'view') {
632
+        return getpaid_get_post_type_label($this->get_post_type($context), false);
633 633
 	}
634 634
 
635 635
 	/**
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @param  string $context View or edit context.
640 640
 	 * @return string
641 641
 	 */
642
-	public function get_post_type( $context = 'view' ) {
643
-        return $this->get_prop( 'post_type', $context );
642
+	public function get_post_type($context = 'view') {
643
+        return $this->get_prop('post_type', $context);
644 644
     }
645 645
 
646 646
     /**
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 	 * @param  string $context View or edit context.
651 651
 	 * @return string
652 652
 	 */
653
-	public function get_mode( $context = 'view' ) {
654
-        return $this->get_prop( 'mode', $context );
653
+	public function get_mode($context = 'view') {
654
+        return $this->get_prop('mode', $context);
655 655
     }
656 656
 
657 657
     /**
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 	 * @param  string $context View or edit context.
662 662
 	 * @return string
663 663
 	 */
664
-	public function get_path( $context = 'view' ) {
665
-        $path   = $this->get_prop( 'path', $context );
664
+	public function get_path($context = 'view') {
665
+        $path = $this->get_prop('path', $context);
666 666
 		$prefix = $this->get_type();
667 667
 
668
-		if ( 0 !== strpos( $path, $prefix ) ) {
669
-			$path = sanitize_title(  $prefix . '-' . $this->get_id()  );
670
-			$this->set_path( $path );
668
+		if (0 !== strpos($path, $prefix)) {
669
+			$path = sanitize_title($prefix . '-' . $this->get_id());
670
+			$this->set_path($path);
671 671
 		}
672 672
 
673 673
 		return $path;
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 * @param  string $context View or edit context.
681 681
 	 * @return string
682 682
 	 */
683
-	public function get_name( $context = 'view' ) {
684
-        return $this->get_prop( 'title', $context );
683
+	public function get_name($context = 'view') {
684
+        return $this->get_prop('title', $context);
685 685
     }
686 686
 
687 687
     /**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 	 * @param  string $context View or edit context.
692 692
 	 * @return string
693 693
 	 */
694
-	public function get_title( $context = 'view' ) {
695
-		return $this->get_name( $context );
694
+	public function get_title($context = 'view') {
695
+		return $this->get_name($context);
696 696
     }
697 697
 
698 698
     /**
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @param  string $context View or edit context.
703 703
 	 * @return string
704 704
 	 */
705
-	public function get_description( $context = 'view' ) {
706
-		return $this->get_prop( 'description', $context );
705
+	public function get_description($context = 'view') {
706
+		return $this->get_prop('description', $context);
707 707
     }
708 708
 
709 709
     /**
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 	 * @param  string $context View or edit context.
714 714
 	 * @return string
715 715
 	 */
716
-	public function get_excerpt( $context = 'view' ) {
717
-		return $this->get_description( $context );
716
+	public function get_excerpt($context = 'view') {
717
+		return $this->get_description($context);
718 718
     }
719 719
 
720 720
     /**
@@ -724,8 +724,8 @@  discard block
 block discarded – undo
724 724
 	 * @param  string $context View or edit context.
725 725
 	 * @return string
726 726
 	 */
727
-	public function get_summary( $context = 'view' ) {
728
-		return $this->get_description( $context );
727
+	public function get_summary($context = 'view') {
728
+		return $this->get_description($context);
729 729
     }
730 730
 
731 731
     /**
@@ -735,25 +735,25 @@  discard block
 block discarded – undo
735 735
      * @param  string $context View or edit context.
736 736
 	 * @return array
737 737
 	 */
738
-    public function get_user_info( $context = 'view' ) {
738
+    public function get_user_info($context = 'view') {
739 739
 
740 740
         $user_info = array(
741
-            'user_id'    => $this->get_user_id( $context ),
742
-            'email'      => $this->get_email( $context ),
743
-            'first_name' => $this->get_first_name( $context ),
744
-            'last_name'  => $this->get_last_name( $context ),
745
-            'address'    => $this->get_address( $context ),
746
-            'phone'      => $this->get_phone( $context ),
747
-            'city'       => $this->get_city( $context ),
748
-            'country'    => $this->get_country( $context ),
749
-            'state'      => $this->get_state( $context ),
750
-            'zip'        => $this->get_zip( $context ),
751
-            'company'    => $this->get_company( $context ),
752
-            'vat_number' => $this->get_vat_number( $context ),
753
-            'discount'   => $this->get_discount_code( $context ),
741
+            'user_id'    => $this->get_user_id($context),
742
+            'email'      => $this->get_email($context),
743
+            'first_name' => $this->get_first_name($context),
744
+            'last_name'  => $this->get_last_name($context),
745
+            'address'    => $this->get_address($context),
746
+            'phone'      => $this->get_phone($context),
747
+            'city'       => $this->get_city($context),
748
+            'country'    => $this->get_country($context),
749
+            'state'      => $this->get_state($context),
750
+            'zip'        => $this->get_zip($context),
751
+            'company'    => $this->get_company($context),
752
+            'vat_number' => $this->get_vat_number($context),
753
+            'discount'   => $this->get_discount_code($context),
754 754
 		);
755 755
 
756
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
756
+		return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this);
757 757
 
758 758
     }
759 759
 
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 	 * @param  string $context View or edit context.
765 765
 	 * @return int
766 766
 	 */
767
-	public function get_author( $context = 'view' ) {
768
-		return (int) $this->get_prop( 'author', $context );
767
+	public function get_author($context = 'view') {
768
+		return (int) $this->get_prop('author', $context);
769 769
     }
770 770
 
771 771
     /**
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 	 * @param  string $context View or edit context.
776 776
 	 * @return int
777 777
 	 */
778
-	public function get_user_id( $context = 'view' ) {
779
-		return $this->get_author( $context );
778
+	public function get_user_id($context = 'view') {
779
+		return $this->get_author($context);
780 780
     }
781 781
 
782 782
      /**
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 	 * @param  string $context View or edit context.
787 787
 	 * @return int
788 788
 	 */
789
-	public function get_customer_id( $context = 'view' ) {
790
-		return $this->get_author( $context );
789
+	public function get_customer_id($context = 'view') {
790
+		return $this->get_author($context);
791 791
     }
792 792
 
793 793
     /**
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 	 * @param  string $context View or edit context.
798 798
 	 * @return string
799 799
 	 */
800
-	public function get_ip( $context = 'view' ) {
801
-		return $this->get_prop( 'user_ip', $context );
800
+	public function get_ip($context = 'view') {
801
+		return $this->get_prop('user_ip', $context);
802 802
     }
803 803
 
804 804
     /**
@@ -808,8 +808,8 @@  discard block
 block discarded – undo
808 808
 	 * @param  string $context View or edit context.
809 809
 	 * @return string
810 810
 	 */
811
-	public function get_user_ip( $context = 'view' ) {
812
-		return $this->get_ip( $context );
811
+	public function get_user_ip($context = 'view') {
812
+		return $this->get_ip($context);
813 813
     }
814 814
 
815 815
      /**
@@ -819,8 +819,8 @@  discard block
 block discarded – undo
819 819
 	 * @param  string $context View or edit context.
820 820
 	 * @return string
821 821
 	 */
822
-	public function get_customer_ip( $context = 'view' ) {
823
-		return $this->get_ip( $context );
822
+	public function get_customer_ip($context = 'view') {
823
+		return $this->get_ip($context);
824 824
     }
825 825
 
826 826
     /**
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
 	 * @param  string $context View or edit context.
831 831
 	 * @return string
832 832
 	 */
833
-	public function get_first_name( $context = 'view' ) {
834
-		return $this->get_prop( 'first_name', $context );
833
+	public function get_first_name($context = 'view') {
834
+		return $this->get_prop('first_name', $context);
835 835
     }
836 836
 
837 837
     /**
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
 	 * @param  string $context View or edit context.
842 842
 	 * @return string
843 843
 	 */
844
-	public function get_user_first_name( $context = 'view' ) {
845
-		return $this->get_first_name( $context );
844
+	public function get_user_first_name($context = 'view') {
845
+		return $this->get_first_name($context);
846 846
     }
847 847
 
848 848
      /**
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
 	 * @param  string $context View or edit context.
853 853
 	 * @return string
854 854
 	 */
855
-	public function get_customer_first_name( $context = 'view' ) {
856
-		return $this->get_first_name( $context );
855
+	public function get_customer_first_name($context = 'view') {
856
+		return $this->get_first_name($context);
857 857
     }
858 858
 
859 859
     /**
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 	 * @param  string $context View or edit context.
864 864
 	 * @return string
865 865
 	 */
866
-	public function get_last_name( $context = 'view' ) {
867
-		return $this->get_prop( 'last_name', $context );
866
+	public function get_last_name($context = 'view') {
867
+		return $this->get_prop('last_name', $context);
868 868
     }
869 869
 
870 870
     /**
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 	 * @param  string $context View or edit context.
875 875
 	 * @return string
876 876
 	 */
877
-	public function get_user_last_name( $context = 'view' ) {
878
-		return $this->get_last_name( $context );
877
+	public function get_user_last_name($context = 'view') {
878
+		return $this->get_last_name($context);
879 879
     }
880 880
 
881 881
     /**
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 	 * @param  string $context View or edit context.
886 886
 	 * @return string
887 887
 	 */
888
-	public function get_customer_last_name( $context = 'view' ) {
889
-		return $this->get_last_name( $context );
888
+	public function get_customer_last_name($context = 'view') {
889
+		return $this->get_last_name($context);
890 890
     }
891 891
 
892 892
     /**
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
 	 * @param  string $context View or edit context.
897 897
 	 * @return string
898 898
 	 */
899
-	public function get_full_name( $context = 'view' ) {
900
-		return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
899
+	public function get_full_name($context = 'view') {
900
+		return trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
901 901
     }
902 902
 
903 903
     /**
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
 	 * @param  string $context View or edit context.
908 908
 	 * @return string
909 909
 	 */
910
-	public function get_user_full_name( $context = 'view' ) {
911
-		return $this->get_full_name( $context );
910
+	public function get_user_full_name($context = 'view') {
911
+		return $this->get_full_name($context);
912 912
     }
913 913
 
914 914
     /**
@@ -918,8 +918,8 @@  discard block
 block discarded – undo
918 918
 	 * @param  string $context View or edit context.
919 919
 	 * @return string
920 920
 	 */
921
-	public function get_customer_full_name( $context = 'view' ) {
922
-		return $this->get_full_name( $context );
921
+	public function get_customer_full_name($context = 'view') {
922
+		return $this->get_full_name($context);
923 923
     }
924 924
 
925 925
     /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 	 * @param  string $context View or edit context.
930 930
 	 * @return string
931 931
 	 */
932
-	public function get_phone( $context = 'view' ) {
933
-		return $this->get_prop( 'phone', $context );
932
+	public function get_phone($context = 'view') {
933
+		return $this->get_prop('phone', $context);
934 934
     }
935 935
 
936 936
     /**
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 	 * @param  string $context View or edit context.
941 941
 	 * @return string
942 942
 	 */
943
-	public function get_phone_number( $context = 'view' ) {
944
-		return $this->get_phone( $context );
943
+	public function get_phone_number($context = 'view') {
944
+		return $this->get_phone($context);
945 945
     }
946 946
 
947 947
     /**
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
 	 * @param  string $context View or edit context.
952 952
 	 * @return string
953 953
 	 */
954
-	public function get_user_phone( $context = 'view' ) {
955
-		return $this->get_phone( $context );
954
+	public function get_user_phone($context = 'view') {
955
+		return $this->get_phone($context);
956 956
     }
957 957
 
958 958
     /**
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  string $context View or edit context.
963 963
 	 * @return string
964 964
 	 */
965
-	public function get_customer_phone( $context = 'view' ) {
966
-		return $this->get_phone( $context );
965
+	public function get_customer_phone($context = 'view') {
966
+		return $this->get_phone($context);
967 967
     }
968 968
 
969 969
     /**
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
 	 * @param  string $context View or edit context.
974 974
 	 * @return string
975 975
 	 */
976
-	public function get_email( $context = 'view' ) {
977
-		return $this->get_prop( 'email', $context );
976
+	public function get_email($context = 'view') {
977
+		return $this->get_prop('email', $context);
978 978
     }
979 979
 
980 980
     /**
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
 	 * @param  string $context View or edit context.
985 985
 	 * @return string
986 986
 	 */
987
-	public function get_email_address( $context = 'view' ) {
988
-		return $this->get_email( $context );
987
+	public function get_email_address($context = 'view') {
988
+		return $this->get_email($context);
989 989
     }
990 990
 
991 991
     /**
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
 	 * @param  string $context View or edit context.
996 996
 	 * @return string
997 997
 	 */
998
-	public function get_user_email( $context = 'view' ) {
999
-		return $this->get_email( $context );
998
+	public function get_user_email($context = 'view') {
999
+		return $this->get_email($context);
1000 1000
     }
1001 1001
 
1002 1002
     /**
@@ -1006,8 +1006,8 @@  discard block
 block discarded – undo
1006 1006
 	 * @param  string $context View or edit context.
1007 1007
 	 * @return string
1008 1008
 	 */
1009
-	public function get_customer_email( $context = 'view' ) {
1010
-		return $this->get_email( $context );
1009
+	public function get_customer_email($context = 'view') {
1010
+		return $this->get_email($context);
1011 1011
     }
1012 1012
 
1013 1013
     /**
@@ -1017,9 +1017,9 @@  discard block
 block discarded – undo
1017 1017
 	 * @param  string $context View or edit context.
1018 1018
 	 * @return string
1019 1019
 	 */
1020
-	public function get_country( $context = 'view' ) {
1021
-		$country = $this->get_prop( 'country', $context );
1022
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1020
+	public function get_country($context = 'view') {
1021
+		$country = $this->get_prop('country', $context);
1022
+		return empty($country) ? wpinv_get_default_country() : $country;
1023 1023
     }
1024 1024
 
1025 1025
     /**
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
 	 * @param  string $context View or edit context.
1030 1030
 	 * @return string
1031 1031
 	 */
1032
-	public function get_user_country( $context = 'view' ) {
1033
-		return $this->get_country( $context );
1032
+	public function get_user_country($context = 'view') {
1033
+		return $this->get_country($context);
1034 1034
     }
1035 1035
 
1036 1036
     /**
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 * @param  string $context View or edit context.
1041 1041
 	 * @return string
1042 1042
 	 */
1043
-	public function get_customer_country( $context = 'view' ) {
1044
-		return $this->get_country( $context );
1043
+	public function get_customer_country($context = 'view') {
1044
+		return $this->get_country($context);
1045 1045
     }
1046 1046
 
1047 1047
     /**
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 	 * @param  string $context View or edit context.
1052 1052
 	 * @return string
1053 1053
 	 */
1054
-	public function get_state( $context = 'view' ) {
1055
-		$state = $this->get_prop( 'state', $context );
1056
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1054
+	public function get_state($context = 'view') {
1055
+		$state = $this->get_prop('state', $context);
1056
+		return empty($state) ? wpinv_get_default_state() : $state;
1057 1057
     }
1058 1058
 
1059 1059
     /**
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 	 * @param  string $context View or edit context.
1064 1064
 	 * @return string
1065 1065
 	 */
1066
-	public function get_user_state( $context = 'view' ) {
1067
-		return $this->get_state( $context );
1066
+	public function get_user_state($context = 'view') {
1067
+		return $this->get_state($context);
1068 1068
     }
1069 1069
 
1070 1070
     /**
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 	 * @param  string $context View or edit context.
1075 1075
 	 * @return string
1076 1076
 	 */
1077
-	public function get_customer_state( $context = 'view' ) {
1078
-		return $this->get_state( $context );
1077
+	public function get_customer_state($context = 'view') {
1078
+		return $this->get_state($context);
1079 1079
     }
1080 1080
 
1081 1081
     /**
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param  string $context View or edit context.
1086 1086
 	 * @return string
1087 1087
 	 */
1088
-	public function get_city( $context = 'view' ) {
1089
-		return $this->get_prop( 'city', $context );
1088
+	public function get_city($context = 'view') {
1089
+		return $this->get_prop('city', $context);
1090 1090
     }
1091 1091
 
1092 1092
     /**
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
 	 * @param  string $context View or edit context.
1097 1097
 	 * @return string
1098 1098
 	 */
1099
-	public function get_user_city( $context = 'view' ) {
1100
-		return $this->get_city( $context );
1099
+	public function get_user_city($context = 'view') {
1100
+		return $this->get_city($context);
1101 1101
     }
1102 1102
 
1103 1103
     /**
@@ -1107,8 +1107,8 @@  discard block
 block discarded – undo
1107 1107
 	 * @param  string $context View or edit context.
1108 1108
 	 * @return string
1109 1109
 	 */
1110
-	public function get_customer_city( $context = 'view' ) {
1111
-		return $this->get_city( $context );
1110
+	public function get_customer_city($context = 'view') {
1111
+		return $this->get_city($context);
1112 1112
     }
1113 1113
 
1114 1114
     /**
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
 	 * @param  string $context View or edit context.
1119 1119
 	 * @return string
1120 1120
 	 */
1121
-	public function get_zip( $context = 'view' ) {
1122
-		return $this->get_prop( 'zip', $context );
1121
+	public function get_zip($context = 'view') {
1122
+		return $this->get_prop('zip', $context);
1123 1123
     }
1124 1124
 
1125 1125
     /**
@@ -1129,8 +1129,8 @@  discard block
 block discarded – undo
1129 1129
 	 * @param  string $context View or edit context.
1130 1130
 	 * @return string
1131 1131
 	 */
1132
-	public function get_user_zip( $context = 'view' ) {
1133
-		return $this->get_zip( $context );
1132
+	public function get_user_zip($context = 'view') {
1133
+		return $this->get_zip($context);
1134 1134
     }
1135 1135
 
1136 1136
     /**
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param  string $context View or edit context.
1141 1141
 	 * @return string
1142 1142
 	 */
1143
-	public function get_customer_zip( $context = 'view' ) {
1144
-		return $this->get_zip( $context );
1143
+	public function get_customer_zip($context = 'view') {
1144
+		return $this->get_zip($context);
1145 1145
     }
1146 1146
 
1147 1147
     /**
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
 	 * @param  string $context View or edit context.
1152 1152
 	 * @return string
1153 1153
 	 */
1154
-	public function get_company( $context = 'view' ) {
1155
-		return $this->get_prop( 'company', $context );
1154
+	public function get_company($context = 'view') {
1155
+		return $this->get_prop('company', $context);
1156 1156
     }
1157 1157
 
1158 1158
     /**
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 	 * @param  string $context View or edit context.
1163 1163
 	 * @return string
1164 1164
 	 */
1165
-	public function get_user_company( $context = 'view' ) {
1166
-		return $this->get_company( $context );
1165
+	public function get_user_company($context = 'view') {
1166
+		return $this->get_company($context);
1167 1167
     }
1168 1168
 
1169 1169
     /**
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
 	 * @param  string $context View or edit context.
1174 1174
 	 * @return string
1175 1175
 	 */
1176
-	public function get_customer_company( $context = 'view' ) {
1177
-		return $this->get_company( $context );
1176
+	public function get_customer_company($context = 'view') {
1177
+		return $this->get_company($context);
1178 1178
     }
1179 1179
 
1180 1180
     /**
@@ -1184,8 +1184,8 @@  discard block
 block discarded – undo
1184 1184
 	 * @param  string $context View or edit context.
1185 1185
 	 * @return string
1186 1186
 	 */
1187
-	public function get_vat_number( $context = 'view' ) {
1188
-		return $this->get_prop( 'vat_number', $context );
1187
+	public function get_vat_number($context = 'view') {
1188
+		return $this->get_prop('vat_number', $context);
1189 1189
     }
1190 1190
 
1191 1191
     /**
@@ -1195,8 +1195,8 @@  discard block
 block discarded – undo
1195 1195
 	 * @param  string $context View or edit context.
1196 1196
 	 * @return string
1197 1197
 	 */
1198
-	public function get_user_vat_number( $context = 'view' ) {
1199
-		return $this->get_vat_number( $context );
1198
+	public function get_user_vat_number($context = 'view') {
1199
+		return $this->get_vat_number($context);
1200 1200
     }
1201 1201
 
1202 1202
     /**
@@ -1206,8 +1206,8 @@  discard block
 block discarded – undo
1206 1206
 	 * @param  string $context View or edit context.
1207 1207
 	 * @return string
1208 1208
 	 */
1209
-	public function get_customer_vat_number( $context = 'view' ) {
1210
-		return $this->get_vat_number( $context );
1209
+	public function get_customer_vat_number($context = 'view') {
1210
+		return $this->get_vat_number($context);
1211 1211
     }
1212 1212
 
1213 1213
     /**
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 	 * @param  string $context View or edit context.
1218 1218
 	 * @return string
1219 1219
 	 */
1220
-	public function get_vat_rate( $context = 'view' ) {
1221
-		return $this->get_prop( 'vat_rate', $context );
1220
+	public function get_vat_rate($context = 'view') {
1221
+		return $this->get_prop('vat_rate', $context);
1222 1222
     }
1223 1223
 
1224 1224
     /**
@@ -1228,8 +1228,8 @@  discard block
 block discarded – undo
1228 1228
 	 * @param  string $context View or edit context.
1229 1229
 	 * @return string
1230 1230
 	 */
1231
-	public function get_user_vat_rate( $context = 'view' ) {
1232
-		return $this->get_vat_rate( $context );
1231
+	public function get_user_vat_rate($context = 'view') {
1232
+		return $this->get_vat_rate($context);
1233 1233
     }
1234 1234
 
1235 1235
     /**
@@ -1239,8 +1239,8 @@  discard block
 block discarded – undo
1239 1239
 	 * @param  string $context View or edit context.
1240 1240
 	 * @return string
1241 1241
 	 */
1242
-	public function get_customer_vat_rate( $context = 'view' ) {
1243
-		return $this->get_vat_rate( $context );
1242
+	public function get_customer_vat_rate($context = 'view') {
1243
+		return $this->get_vat_rate($context);
1244 1244
     }
1245 1245
 
1246 1246
     /**
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 	 * @param  string $context View or edit context.
1251 1251
 	 * @return string
1252 1252
 	 */
1253
-	public function get_address( $context = 'view' ) {
1254
-		return $this->get_prop( 'address', $context );
1253
+	public function get_address($context = 'view') {
1254
+		return $this->get_prop('address', $context);
1255 1255
     }
1256 1256
 
1257 1257
     /**
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
 	 * @param  string $context View or edit context.
1262 1262
 	 * @return string
1263 1263
 	 */
1264
-	public function get_user_address( $context = 'view' ) {
1265
-		return $this->get_address( $context );
1264
+	public function get_user_address($context = 'view') {
1265
+		return $this->get_address($context);
1266 1266
     }
1267 1267
 
1268 1268
     /**
@@ -1272,8 +1272,8 @@  discard block
 block discarded – undo
1272 1272
 	 * @param  string $context View or edit context.
1273 1273
 	 * @return string
1274 1274
 	 */
1275
-	public function get_customer_address( $context = 'view' ) {
1276
-		return $this->get_address( $context );
1275
+	public function get_customer_address($context = 'view') {
1276
+		return $this->get_address($context);
1277 1277
     }
1278 1278
 
1279 1279
     /**
@@ -1283,8 +1283,8 @@  discard block
 block discarded – undo
1283 1283
 	 * @param  string $context View or edit context.
1284 1284
 	 * @return bool
1285 1285
 	 */
1286
-	public function get_is_viewed( $context = 'view' ) {
1287
-		return (bool) $this->get_prop( 'is_viewed', $context );
1286
+	public function get_is_viewed($context = 'view') {
1287
+		return (bool) $this->get_prop('is_viewed', $context);
1288 1288
 	}
1289 1289
 
1290 1290
 	/**
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
 	 * @param  string $context View or edit context.
1295 1295
 	 * @return bool
1296 1296
 	 */
1297
-	public function get_email_cc( $context = 'view' ) {
1298
-		return $this->get_prop( 'email_cc', $context );
1297
+	public function get_email_cc($context = 'view') {
1298
+		return $this->get_prop('email_cc', $context);
1299 1299
 	}
1300 1300
 
1301 1301
 	/**
@@ -1305,8 +1305,8 @@  discard block
 block discarded – undo
1305 1305
 	 * @param  string $context View or edit context.
1306 1306
 	 * @return bool
1307 1307
 	 */
1308
-	public function get_template( $context = 'view' ) {
1309
-		return $this->get_prop( 'template', $context );
1308
+	public function get_template($context = 'view') {
1309
+		return $this->get_prop('template', $context);
1310 1310
 	}
1311 1311
 
1312 1312
 	/**
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
 	 * @param  string $context View or edit context.
1317 1317
 	 * @return bool
1318 1318
 	 */
1319
-	public function get_created_via( $context = 'view' ) {
1320
-		return $this->get_prop( 'created_via', $context );
1319
+	public function get_created_via($context = 'view') {
1320
+		return $this->get_prop('created_via', $context);
1321 1321
 	}
1322 1322
 
1323 1323
 	/**
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
 	 * @param  string $context View or edit context.
1328 1328
 	 * @return bool
1329 1329
 	 */
1330
-	public function get_address_confirmed( $context = 'view' ) {
1331
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1330
+	public function get_address_confirmed($context = 'view') {
1331
+		return (bool) $this->get_prop('address_confirmed', $context);
1332 1332
     }
1333 1333
 
1334 1334
     /**
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
 	 * @param  string $context View or edit context.
1339 1339
 	 * @return bool
1340 1340
 	 */
1341
-	public function get_user_address_confirmed( $context = 'view' ) {
1342
-		return $this->get_address_confirmed( $context );
1341
+	public function get_user_address_confirmed($context = 'view') {
1342
+		return $this->get_address_confirmed($context);
1343 1343
     }
1344 1344
 
1345 1345
     /**
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 	 * @param  string $context View or edit context.
1350 1350
 	 * @return bool
1351 1351
 	 */
1352
-	public function get_customer_address_confirmed( $context = 'view' ) {
1353
-		return $this->get_address_confirmed( $context );
1352
+	public function get_customer_address_confirmed($context = 'view') {
1353
+		return $this->get_address_confirmed($context);
1354 1354
     }
1355 1355
 
1356 1356
     /**
@@ -1360,12 +1360,12 @@  discard block
 block discarded – undo
1360 1360
 	 * @param  string $context View or edit context.
1361 1361
 	 * @return float
1362 1362
 	 */
1363
-	public function get_subtotal( $context = 'view' ) {
1364
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1363
+	public function get_subtotal($context = 'view') {
1364
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1365 1365
 
1366 1366
         // Backwards compatibility.
1367
-        if ( is_bool( $context ) && $context ) {
1368
-            return wpinv_price( $subtotal, $this->get_currency() );
1367
+        if (is_bool($context) && $context) {
1368
+            return wpinv_price($subtotal, $this->get_currency());
1369 1369
         }
1370 1370
 
1371 1371
         return $subtotal;
@@ -1378,8 +1378,8 @@  discard block
 block discarded – undo
1378 1378
 	 * @param  string $context View or edit context.
1379 1379
 	 * @return float
1380 1380
 	 */
1381
-	public function get_total_discount( $context = 'view' ) {
1382
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1381
+	public function get_total_discount($context = 'view') {
1382
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_discount', $context)));
1383 1383
     }
1384 1384
 
1385 1385
     /**
@@ -1389,18 +1389,18 @@  discard block
 block discarded – undo
1389 1389
 	 * @param  string $context View or edit context.
1390 1390
 	 * @return float
1391 1391
 	 */
1392
-	public function get_total_tax( $context = 'view' ) {
1393
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1392
+	public function get_total_tax($context = 'view') {
1393
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_tax', $context)));
1394 1394
 	}
1395 1395
 
1396 1396
 	/**
1397 1397
 	 * @deprecated
1398 1398
 	 */
1399
-	public function get_final_tax( $currency = false ) {
1399
+	public function get_final_tax($currency = false) {
1400 1400
 		$tax = $this->get_total_tax();
1401 1401
 
1402
-        if ( $currency ) {
1403
-			return wpinv_price( $tax, $this->get_currency() );
1402
+        if ($currency) {
1403
+			return wpinv_price($tax, $this->get_currency());
1404 1404
         }
1405 1405
 
1406 1406
         return $tax;
@@ -1413,8 +1413,8 @@  discard block
 block discarded – undo
1413 1413
 	 * @param  string $context View or edit context.
1414 1414
 	 * @return float
1415 1415
 	 */
1416
-	public function get_total_fees( $context = 'view' ) {
1417
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1416
+	public function get_total_fees($context = 'view') {
1417
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_fees', $context)));
1418 1418
     }
1419 1419
 
1420 1420
     /**
@@ -1424,8 +1424,8 @@  discard block
 block discarded – undo
1424 1424
 	 * @param  string $context View or edit context.
1425 1425
 	 * @return float
1426 1426
 	 */
1427
-	public function get_fees_total( $context = 'view' ) {
1428
-		return $this->get_total_fees( $context );
1427
+	public function get_fees_total($context = 'view') {
1428
+		return $this->get_total_fees($context);
1429 1429
     }
1430 1430
 
1431 1431
     /**
@@ -1434,8 +1434,8 @@  discard block
 block discarded – undo
1434 1434
 	 * @since 1.0.19
1435 1435
      * @return float
1436 1436
 	 */
1437
-	public function get_total( $context = 'view' ) {
1438
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total', $context ) ) );
1437
+	public function get_total($context = 'view') {
1438
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total', $context)));
1439 1439
 	}
1440 1440
 
1441 1441
 	/**
@@ -1447,20 +1447,20 @@  discard block
 block discarded – undo
1447 1447
 	public function get_non_recurring_total() {
1448 1448
 
1449 1449
 		$subtotal = 0;
1450
-		foreach ( $this->get_items() as $item ) {
1451
-			if ( ! $item->is_recurring() ) {
1450
+		foreach ($this->get_items() as $item) {
1451
+			if (!$item->is_recurring()) {
1452 1452
 				$subtotal += $item->get_sub_total();
1453 1453
 			}
1454 1454
 		}
1455 1455
 
1456
-		foreach ( $this->get_fees() as $fee ) {
1457
-			if ( empty( $fee['recurring_fee'] ) ) {
1458
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1456
+		foreach ($this->get_fees() as $fee) {
1457
+			if (empty($fee['recurring_fee'])) {
1458
+				$subtotal += wpinv_sanitize_amount($fee['initial_fee']);
1459 1459
 			}
1460 1460
 		}
1461 1461
 
1462
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1463
-        return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1462
+		$subtotal = wpinv_round_amount(wpinv_sanitize_amount($subtotal));
1463
+        return apply_filters('wpinv_get_non_recurring_invoice_total', $subtotal, $this);
1464 1464
 
1465 1465
     }
1466 1466
 
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 	 */
1484 1484
     public function get_initial_total() {
1485 1485
 
1486
-		if ( empty( $this->totals ) ) {
1486
+		if (empty($this->totals)) {
1487 1487
 			$this->recalculate_total();
1488 1488
 		}
1489 1489
 
@@ -1493,12 +1493,12 @@  discard block
 block discarded – undo
1493 1493
 		$subtotal = $this->totals['subtotal']['initial'];
1494 1494
 		$total    = $tax + $fee - $discount + $subtotal;
1495 1495
 
1496
-		if ( 0 > $total ) {
1496
+		if (0 > $total) {
1497 1497
 			$total = 0;
1498 1498
 		}
1499 1499
 
1500
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1501
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1500
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1501
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1502 1502
 	}
1503 1503
 
1504 1504
 	/**
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 	 */
1511 1511
     public function get_recurring_total() {
1512 1512
 
1513
-		if ( empty( $this->totals ) ) {
1513
+		if (empty($this->totals)) {
1514 1514
 			$this->recalculate_total();
1515 1515
 		}
1516 1516
 
@@ -1520,12 +1520,12 @@  discard block
 block discarded – undo
1520 1520
 		$subtotal = $this->totals['subtotal']['recurring'];
1521 1521
 		$total    = $tax + $fee - $discount + $subtotal;
1522 1522
 
1523
-		if ( 0 > $total ) {
1523
+		if (0 > $total) {
1524 1524
 			$total = 0;
1525 1525
 		}
1526 1526
 
1527
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1528
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1527
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1528
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1529 1529
 	}
1530 1530
 
1531 1531
 	/**
@@ -1536,10 +1536,10 @@  discard block
 block discarded – undo
1536 1536
 	 * @param string $currency Whether to include the currency.
1537 1537
      * @return float|string
1538 1538
 	 */
1539
-    public function get_recurring_details( $field = '', $currency = false ) {
1539
+    public function get_recurring_details($field = '', $currency = false) {
1540 1540
 
1541 1541
 		// Maybe recalculate totals.
1542
-		if ( empty( $this->totals ) ) {
1542
+		if (empty($this->totals)) {
1543 1543
 			$this->recalculate_total();
1544 1544
 		}
1545 1545
 
@@ -1559,8 +1559,8 @@  discard block
 block discarded – undo
1559 1559
 			$currency
1560 1560
 		);
1561 1561
 
1562
-        if ( isset( $data[$field] ) ) {
1563
-            return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] );
1562
+        if (isset($data[$field])) {
1563
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1564 1564
         }
1565 1565
 
1566 1566
         return $data;
@@ -1573,8 +1573,8 @@  discard block
 block discarded – undo
1573 1573
 	 * @param  string $context View or edit context.
1574 1574
 	 * @return array
1575 1575
 	 */
1576
-	public function get_fees( $context = 'view' ) {
1577
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1576
+	public function get_fees($context = 'view') {
1577
+		return wpinv_parse_list($this->get_prop('fees', $context));
1578 1578
     }
1579 1579
 
1580 1580
     /**
@@ -1584,8 +1584,8 @@  discard block
 block discarded – undo
1584 1584
 	 * @param  string $context View or edit context.
1585 1585
 	 * @return array
1586 1586
 	 */
1587
-	public function get_discounts( $context = 'view' ) {
1588
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1587
+	public function get_discounts($context = 'view') {
1588
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1589 1589
     }
1590 1590
 
1591 1591
     /**
@@ -1595,8 +1595,8 @@  discard block
 block discarded – undo
1595 1595
 	 * @param  string $context View or edit context.
1596 1596
 	 * @return array
1597 1597
 	 */
1598
-	public function get_taxes( $context = 'view' ) {
1599
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1598
+	public function get_taxes($context = 'view') {
1599
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1600 1600
     }
1601 1601
 
1602 1602
     /**
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
 	 * @param  string $context View or edit context.
1607 1607
 	 * @return GetPaid_Form_Item[]
1608 1608
 	 */
1609
-	public function get_items( $context = 'view' ) {
1610
-        return $this->get_prop( 'items', $context );
1609
+	public function get_items($context = 'view') {
1610
+        return $this->get_prop('items', $context);
1611 1611
 	}
1612 1612
 
1613 1613
 	/**
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 	 * @return string
1618 1618
 	 */
1619 1619
 	public function get_item_ids() {
1620
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1620
+		return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id'));
1621 1621
     }
1622 1622
 
1623 1623
     /**
@@ -1627,8 +1627,8 @@  discard block
 block discarded – undo
1627 1627
 	 * @param  string $context View or edit context.
1628 1628
 	 * @return int
1629 1629
 	 */
1630
-	public function get_payment_form( $context = 'view' ) {
1631
-		return intval( $this->get_prop( 'payment_form', $context ) );
1630
+	public function get_payment_form($context = 'view') {
1631
+		return intval($this->get_prop('payment_form', $context));
1632 1632
     }
1633 1633
 
1634 1634
     /**
@@ -1638,8 +1638,8 @@  discard block
 block discarded – undo
1638 1638
 	 * @param  string $context View or edit context.
1639 1639
 	 * @return string
1640 1640
 	 */
1641
-	public function get_submission_id( $context = 'view' ) {
1642
-		return $this->get_prop( 'submission_id', $context );
1641
+	public function get_submission_id($context = 'view') {
1642
+		return $this->get_prop('submission_id', $context);
1643 1643
     }
1644 1644
 
1645 1645
     /**
@@ -1649,8 +1649,8 @@  discard block
 block discarded – undo
1649 1649
 	 * @param  string $context View or edit context.
1650 1650
 	 * @return string
1651 1651
 	 */
1652
-	public function get_discount_code( $context = 'view' ) {
1653
-		return $this->get_prop( 'discount_code', $context );
1652
+	public function get_discount_code($context = 'view') {
1653
+		return $this->get_prop('discount_code', $context);
1654 1654
     }
1655 1655
 
1656 1656
     /**
@@ -1660,8 +1660,8 @@  discard block
 block discarded – undo
1660 1660
 	 * @param  string $context View or edit context.
1661 1661
 	 * @return string
1662 1662
 	 */
1663
-	public function get_gateway( $context = 'view' ) {
1664
-		return $this->get_prop( 'gateway', $context );
1663
+	public function get_gateway($context = 'view') {
1664
+		return $this->get_prop('gateway', $context);
1665 1665
     }
1666 1666
 
1667 1667
     /**
@@ -1671,8 +1671,8 @@  discard block
 block discarded – undo
1671 1671
 	 * @return string
1672 1672
 	 */
1673 1673
     public function get_gateway_title() {
1674
-        $title =  wpinv_get_gateway_checkout_label( $this->get_gateway() );
1675
-        return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1674
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1675
+        return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this);
1676 1676
     }
1677 1677
 
1678 1678
     /**
@@ -1682,8 +1682,8 @@  discard block
 block discarded – undo
1682 1682
 	 * @param  string $context View or edit context.
1683 1683
 	 * @return string
1684 1684
 	 */
1685
-	public function get_transaction_id( $context = 'view' ) {
1686
-		return $this->get_prop( 'transaction_id', $context );
1685
+	public function get_transaction_id($context = 'view') {
1686
+		return $this->get_prop('transaction_id', $context);
1687 1687
     }
1688 1688
 
1689 1689
     /**
@@ -1693,9 +1693,9 @@  discard block
 block discarded – undo
1693 1693
 	 * @param  string $context View or edit context.
1694 1694
 	 * @return string
1695 1695
 	 */
1696
-	public function get_currency( $context = 'view' ) {
1697
-        $currency = $this->get_prop( 'currency', $context );
1698
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1696
+	public function get_currency($context = 'view') {
1697
+        $currency = $this->get_prop('currency', $context);
1698
+        return empty($currency) ? wpinv_get_currency() : $currency;
1699 1699
     }
1700 1700
 
1701 1701
     /**
@@ -1705,8 +1705,8 @@  discard block
 block discarded – undo
1705 1705
 	 * @param  string $context View or edit context.
1706 1706
 	 * @return bool
1707 1707
 	 */
1708
-	public function get_disable_taxes( $context = 'view' ) {
1709
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1708
+	public function get_disable_taxes($context = 'view') {
1709
+        return (bool) $this->get_prop('disable_taxes', $context);
1710 1710
     }
1711 1711
 
1712 1712
     /**
@@ -1716,8 +1716,8 @@  discard block
 block discarded – undo
1716 1716
 	 * @param  string $context View or edit context.
1717 1717
 	 * @return int
1718 1718
 	 */
1719
-    public function get_subscription_id( $context = 'view' ) {
1720
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1719
+    public function get_subscription_id($context = 'view') {
1720
+		return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context);
1721 1721
 	}
1722 1722
 
1723 1723
 	/**
@@ -1727,12 +1727,12 @@  discard block
 block discarded – undo
1727 1727
 	 * @param  string $context View or edit context.
1728 1728
 	 * @return int
1729 1729
 	 */
1730
-    public function get_remote_subscription_id( $context = 'view' ) {
1731
-        $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1730
+    public function get_remote_subscription_id($context = 'view') {
1731
+        $subscription_id = $this->get_prop('remote_subscription_id', $context);
1732 1732
 
1733
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1733
+        if (empty($subscription_id) && $this->is_renewal()) {
1734 1734
             $parent = $this->get_parent();
1735
-            return $parent->get_remote_subscription_id( $context );
1735
+            return $parent->get_remote_subscription_id($context);
1736 1736
         }
1737 1737
 
1738 1738
         return $subscription_id;
@@ -1745,20 +1745,20 @@  discard block
 block discarded – undo
1745 1745
 	 * @param  string $context View or edit context.
1746 1746
 	 * @return array
1747 1747
 	 */
1748
-    public function get_payment_meta( $context = 'view' ) {
1748
+    public function get_payment_meta($context = 'view') {
1749 1749
 
1750 1750
         return array(
1751
-            'price'        => $this->get_total( $context ),
1752
-            'date'         => $this->get_date_created( $context ),
1753
-            'user_email'   => $this->get_email( $context ),
1754
-            'invoice_key'  => $this->get_key( $context ),
1755
-            'currency'     => $this->get_currency( $context ),
1756
-            'items'        => $this->get_items( $context ),
1757
-            'user_info'    => $this->get_user_info( $context ),
1751
+            'price'        => $this->get_total($context),
1752
+            'date'         => $this->get_date_created($context),
1753
+            'user_email'   => $this->get_email($context),
1754
+            'invoice_key'  => $this->get_key($context),
1755
+            'currency'     => $this->get_currency($context),
1756
+            'items'        => $this->get_items($context),
1757
+            'user_info'    => $this->get_user_info($context),
1758 1758
             'cart_details' => $this->get_cart_details(),
1759
-            'status'       => $this->get_status( $context ),
1760
-            'fees'         => $this->get_fees( $context ),
1761
-            'taxes'        => $this->get_taxes( $context ),
1759
+            'status'       => $this->get_status($context),
1760
+            'fees'         => $this->get_fees($context),
1761
+            'taxes'        => $this->get_taxes($context),
1762 1762
         );
1763 1763
 
1764 1764
     }
@@ -1773,9 +1773,9 @@  discard block
 block discarded – undo
1773 1773
         $items        = $this->get_items();
1774 1774
         $cart_details = array();
1775 1775
 
1776
-        foreach ( $items as $item ) {
1776
+        foreach ($items as $item) {
1777 1777
 			$item->invoice_id = $this->get_id();
1778
-            $cart_details[]   = $item->prepare_data_for_saving();
1778
+            $cart_details[] = $item->prepare_data_for_saving();
1779 1779
         }
1780 1780
 
1781 1781
         return $cart_details;
@@ -1786,11 +1786,11 @@  discard block
 block discarded – undo
1786 1786
 	 *
1787 1787
 	 * @return null|GetPaid_Form_Item|int
1788 1788
 	 */
1789
-	public function get_recurring( $object = false ) {
1789
+	public function get_recurring($object = false) {
1790 1790
 
1791 1791
 		// Are we returning an object?
1792
-        if ( $object ) {
1793
-            return $this->get_item( $this->recurring_item );
1792
+        if ($object) {
1793
+            return $this->get_item($this->recurring_item);
1794 1794
         }
1795 1795
 
1796 1796
         return $this->recurring_item;
@@ -1805,15 +1805,15 @@  discard block
 block discarded – undo
1805 1805
 	public function get_subscription_name() {
1806 1806
 
1807 1807
 		// Retrieve the recurring name
1808
-        $item = $this->get_recurring( true );
1808
+        $item = $this->get_recurring(true);
1809 1809
 
1810 1810
 		// Abort if it does not exist.
1811
-        if ( empty( $item ) ) {
1811
+        if (empty($item)) {
1812 1812
             return '';
1813 1813
         }
1814 1814
 
1815 1815
 		// Return the item name.
1816
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1816
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1817 1817
 	}
1818 1818
 
1819 1819
 	/**
@@ -1823,9 +1823,9 @@  discard block
 block discarded – undo
1823 1823
 	 * @return string
1824 1824
 	 */
1825 1825
 	public function get_view_url() {
1826
-        $invoice_url = get_permalink( $this->get_id() );
1827
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1828
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1826
+        $invoice_url = get_permalink($this->get_id());
1827
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1828
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1829 1829
 	}
1830 1830
 
1831 1831
 	/**
@@ -1834,25 +1834,25 @@  discard block
 block discarded – undo
1834 1834
 	 * @since 1.0.19
1835 1835
 	 * @return string
1836 1836
 	 */
1837
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1837
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1838 1838
 
1839 1839
 		// Retrieve the checkout url.
1840 1840
         $pay_url = wpinv_get_checkout_uri();
1841 1841
 
1842 1842
 		// Maybe force ssl.
1843
-        if ( is_ssl() ) {
1844
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1843
+        if (is_ssl()) {
1844
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1845 1845
         }
1846 1846
 
1847 1847
 		// Add the invoice key.
1848
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1848
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1849 1849
 
1850 1850
 		// (Maybe?) add a secret
1851
-        if ( $secret ) {
1852
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1851
+        if ($secret) {
1852
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1853 1853
         }
1854 1854
 
1855
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1855
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1856 1856
 	}
1857 1857
 	
1858 1858
 	/**
@@ -1867,14 +1867,14 @@  discard block
 block discarded – undo
1867 1867
         $receipt_url = wpinv_get_success_page_uri();
1868 1868
 
1869 1869
 		// Maybe force ssl.
1870
-        if ( is_ssl() ) {
1871
-            $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1870
+        if (is_ssl()) {
1871
+            $receipt_url = str_replace('http:', 'https:', $receipt_url);
1872 1872
         }
1873 1873
 
1874 1874
 		// Add the invoice key.
1875
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1875
+		$receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url);
1876 1876
 
1877
-        return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1877
+        return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this);
1878 1878
 	}
1879 1879
 	
1880 1880
 	/**
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 
1888 1888
 		$type   = $this->get_type();
1889 1889
 		$status = "wpi-$type-pending";
1890
-		return str_replace( '-invoice', '', $status );
1890
+		return str_replace('-invoice', '', $status);
1891 1891
 
1892 1892
 	}
1893 1893
 
@@ -1901,8 +1901,8 @@  discard block
 block discarded – undo
1901 1901
 	 * @param  string $context View or edit context.
1902 1902
 	 * @return mixed Value of the given invoice property (if set).
1903 1903
 	 */
1904
-	public function get( $key, $context = 'view' ) {
1905
-        return $this->get_prop( $key, $context );
1904
+	public function get($key, $context = 'view') {
1905
+        return $this->get_prop($key, $context);
1906 1906
 	}
1907 1907
 
1908 1908
     /*
@@ -1925,11 +1925,11 @@  discard block
 block discarded – undo
1925 1925
 	 * @param  mixed $value new value.
1926 1926
 	 * @return mixed Value of the given invoice property (if set).
1927 1927
 	 */
1928
-	public function set( $key, $value ) {
1928
+	public function set($key, $value) {
1929 1929
 
1930 1930
         $setter = "set_$key";
1931
-        if ( is_callable( array( $this, $setter ) ) ) {
1932
-            $this->{$setter}( $value );
1931
+        if (is_callable(array($this, $setter))) {
1932
+            $this->{$setter}($value);
1933 1933
         }
1934 1934
 
1935 1935
 	}
@@ -1943,45 +1943,45 @@  discard block
 block discarded – undo
1943 1943
 	 * @param bool   $manual_update Is this a manual status change?.
1944 1944
 	 * @return array details of change.
1945 1945
 	 */
1946
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
1946
+	public function set_status($new_status, $note = '', $manual_update = false) {
1947 1947
 		$old_status = $this->get_status();
1948 1948
 
1949 1949
 		$statuses = $this->get_all_statuses();
1950 1950
 
1951
-		if ( isset( $statuses[ 'draft' ] ) ) {
1952
-			unset( $statuses[ 'draft' ] );
1951
+		if (isset($statuses['draft'])) {
1952
+			unset($statuses['draft']);
1953 1953
 		}
1954 1954
 
1955
-		$this->set_prop( 'status', $new_status );
1955
+		$this->set_prop('status', $new_status);
1956 1956
 
1957 1957
 		// If setting the status, ensure it's set to a valid status.
1958
-		if ( true === $this->object_read ) {
1958
+		if (true === $this->object_read) {
1959 1959
 
1960 1960
 			// Only allow valid new status.
1961
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
1961
+			if (!array_key_exists($new_status, $statuses)) {
1962 1962
 				$new_status = $this->get_default_status();
1963 1963
 			}
1964 1964
 
1965 1965
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1966
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
1966
+			if ($old_status && !array_key_exists($new_status, $statuses)) {
1967 1967
 				$old_status = $this->get_default_status();
1968 1968
 			}
1969 1969
 
1970 1970
 			// Paid - Renewal (i.e when duplicating a parent invoice )
1971
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
1971
+			if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) {
1972 1972
 				$old_status = 'wpi-pending';
1973 1973
 			}
1974 1974
 
1975
-			if ( $old_status !== $new_status ) {
1975
+			if ($old_status !== $new_status) {
1976 1976
 				$this->status_transition = array(
1977
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1977
+					'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
1978 1978
 					'to'     => $new_status,
1979 1979
 					'note'   => $note,
1980 1980
 					'manual' => (bool) $manual_update,
1981 1981
 				);
1982 1982
 
1983
-				if ( $manual_update ) {
1984
-					do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1983
+				if ($manual_update) {
1984
+					do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
1985 1985
 				}
1986 1986
 
1987 1987
 				$this->maybe_set_date_paid();
@@ -2006,8 +2006,8 @@  discard block
 block discarded – undo
2006 2006
 	 */
2007 2007
 	public function maybe_set_date_paid() {
2008 2008
 
2009
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2010
-			$this->set_date_completed( current_time( 'mysql' ) );
2009
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
2010
+			$this->set_date_completed(current_time('mysql'));
2011 2011
 		}
2012 2012
 	}
2013 2013
 
@@ -2016,11 +2016,11 @@  discard block
 block discarded – undo
2016 2016
 	 *
2017 2017
 	 * @since 1.0.19
2018 2018
 	 */
2019
-	public function set_parent_id( $value ) {
2020
-		if ( $value && ( $value === $this->get_id() ) ) {
2019
+	public function set_parent_id($value) {
2020
+		if ($value && ($value === $this->get_id())) {
2021 2021
 			return;
2022 2022
 		}
2023
-		$this->set_prop( 'parent_id', absint( $value ) );
2023
+		$this->set_prop('parent_id', absint($value));
2024 2024
     }
2025 2025
 
2026 2026
     /**
@@ -2028,8 +2028,8 @@  discard block
 block discarded – undo
2028 2028
 	 *
2029 2029
 	 * @since 1.0.19
2030 2030
 	 */
2031
-	public function set_version( $value ) {
2032
-		$this->set_prop( 'version', $value );
2031
+	public function set_version($value) {
2032
+		$this->set_prop('version', $value);
2033 2033
     }
2034 2034
 
2035 2035
     /**
@@ -2039,15 +2039,15 @@  discard block
 block discarded – undo
2039 2039
 	 * @param string $value Value to set.
2040 2040
      * @return bool Whether or not the date was set.
2041 2041
 	 */
2042
-	public function set_date_created( $value ) {
2043
-        $date = strtotime( $value );
2042
+	public function set_date_created($value) {
2043
+        $date = strtotime($value);
2044 2044
 
2045
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2046
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
2045
+        if ($date && $value !== '0000-00-00 00:00:00') {
2046
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
2047 2047
             return true;
2048 2048
         }
2049 2049
 
2050
-		$this->set_prop( 'date_created', '' );
2050
+		$this->set_prop('date_created', '');
2051 2051
 		return false;
2052 2052
 
2053 2053
     }
@@ -2059,15 +2059,15 @@  discard block
 block discarded – undo
2059 2059
 	 * @param string $value Value to set.
2060 2060
      * @return bool Whether or not the date was set.
2061 2061
 	 */
2062
-	public function set_due_date( $value ) {
2063
-        $date = strtotime( $value );
2062
+	public function set_due_date($value) {
2063
+        $date = strtotime($value);
2064 2064
 
2065
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2066
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
2065
+        if ($date && $value !== '0000-00-00 00:00:00') {
2066
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
2067 2067
             return true;
2068 2068
         }
2069 2069
 
2070
-		$this->set_prop( 'due_date', '' );
2070
+		$this->set_prop('due_date', '');
2071 2071
         return false;
2072 2072
 
2073 2073
     }
@@ -2078,8 +2078,8 @@  discard block
 block discarded – undo
2078 2078
 	 * @since 1.0.19
2079 2079
 	 * @param  string $value New name.
2080 2080
 	 */
2081
-	public function set_date_due( $value ) {
2082
-		$this->set_due_date( $value );
2081
+	public function set_date_due($value) {
2082
+		$this->set_due_date($value);
2083 2083
     }
2084 2084
 
2085 2085
     /**
@@ -2089,15 +2089,15 @@  discard block
 block discarded – undo
2089 2089
 	 * @param string $value Value to set.
2090 2090
      * @return bool Whether or not the date was set.
2091 2091
 	 */
2092
-	public function set_completed_date( $value ) {
2093
-        $date = strtotime( $value );
2092
+	public function set_completed_date($value) {
2093
+        $date = strtotime($value);
2094 2094
 
2095
-        if ( $date && $value !== '0000-00-00 00:00:00'  ) {
2096
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
2095
+        if ($date && $value !== '0000-00-00 00:00:00') {
2096
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
2097 2097
             return true;
2098 2098
         }
2099 2099
 
2100
-		$this->set_prop( 'completed_date', '' );
2100
+		$this->set_prop('completed_date', '');
2101 2101
         return false;
2102 2102
 
2103 2103
     }
@@ -2108,8 +2108,8 @@  discard block
 block discarded – undo
2108 2108
 	 * @since 1.0.19
2109 2109
 	 * @param  string $value New name.
2110 2110
 	 */
2111
-	public function set_date_completed( $value ) {
2112
-		$this->set_completed_date( $value );
2111
+	public function set_date_completed($value) {
2112
+		$this->set_completed_date($value);
2113 2113
     }
2114 2114
 
2115 2115
     /**
@@ -2119,15 +2119,15 @@  discard block
 block discarded – undo
2119 2119
 	 * @param string $value Value to set.
2120 2120
      * @return bool Whether or not the date was set.
2121 2121
 	 */
2122
-	public function set_date_modified( $value ) {
2123
-        $date = strtotime( $value );
2122
+	public function set_date_modified($value) {
2123
+        $date = strtotime($value);
2124 2124
 
2125
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2126
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
2125
+        if ($date && $value !== '0000-00-00 00:00:00') {
2126
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
2127 2127
             return true;
2128 2128
         }
2129 2129
 
2130
-		$this->set_prop( 'date_modified', '' );
2130
+		$this->set_prop('date_modified', '');
2131 2131
         return false;
2132 2132
 
2133 2133
     }
@@ -2138,9 +2138,9 @@  discard block
 block discarded – undo
2138 2138
 	 * @since 1.0.19
2139 2139
 	 * @param  string $value New number.
2140 2140
 	 */
2141
-	public function set_number( $value ) {
2142
-        $number = sanitize_text_field( $value );
2143
-		$this->set_prop( 'number', $number );
2141
+	public function set_number($value) {
2142
+        $number = sanitize_text_field($value);
2143
+		$this->set_prop('number', $number);
2144 2144
     }
2145 2145
 
2146 2146
     /**
@@ -2149,9 +2149,9 @@  discard block
 block discarded – undo
2149 2149
 	 * @since 1.0.19
2150 2150
 	 * @param  string $value Type.
2151 2151
 	 */
2152
-	public function set_type( $value ) {
2153
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2154
-		$this->set_prop( 'type', $type );
2152
+	public function set_type($value) {
2153
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
2154
+		$this->set_prop('type', $type);
2155 2155
 	}
2156 2156
 
2157 2157
     /**
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
 	 * @since 1.0.19
2161 2161
 	 * @param  string $value Post type.
2162 2162
 	 */
2163
-	public function set_post_type( $value ) {
2164
-        if ( getpaid_is_invoice_post_type( $value ) ) {
2165
-			$this->set_type( $value );
2166
-            $this->set_prop( 'post_type', $value );
2163
+	public function set_post_type($value) {
2164
+        if (getpaid_is_invoice_post_type($value)) {
2165
+			$this->set_type($value);
2166
+            $this->set_prop('post_type', $value);
2167 2167
         }
2168 2168
     }
2169 2169
 
@@ -2173,9 +2173,9 @@  discard block
 block discarded – undo
2173 2173
 	 * @since 1.0.19
2174 2174
 	 * @param  string $value New key.
2175 2175
 	 */
2176
-	public function set_key( $value ) {
2177
-        $key = sanitize_text_field( $value );
2178
-		$this->set_prop( 'key', $key );
2176
+	public function set_key($value) {
2177
+        $key = sanitize_text_field($value);
2178
+		$this->set_prop('key', $key);
2179 2179
     }
2180 2180
 
2181 2181
     /**
@@ -2184,9 +2184,9 @@  discard block
 block discarded – undo
2184 2184
 	 * @since 1.0.19
2185 2185
 	 * @param  string $value mode.
2186 2186
 	 */
2187
-	public function set_mode( $value ) {
2188
-        if ( in_array( $value, array( 'live', 'test' ) ) ) {
2189
-            $this->set_prop( 'mode', $value );
2187
+	public function set_mode($value) {
2188
+        if (in_array($value, array('live', 'test'))) {
2189
+            $this->set_prop('mode', $value);
2190 2190
         }
2191 2191
     }
2192 2192
 
@@ -2196,8 +2196,8 @@  discard block
 block discarded – undo
2196 2196
 	 * @since 1.0.19
2197 2197
 	 * @param  string $value path.
2198 2198
 	 */
2199
-	public function set_path( $value ) {
2200
-        $this->set_prop( 'path', $value );
2199
+	public function set_path($value) {
2200
+        $this->set_prop('path', $value);
2201 2201
     }
2202 2202
 
2203 2203
     /**
@@ -2206,9 +2206,9 @@  discard block
 block discarded – undo
2206 2206
 	 * @since 1.0.19
2207 2207
 	 * @param  string $value New name.
2208 2208
 	 */
2209
-	public function set_name( $value ) {
2210
-        $name = sanitize_text_field( $value );
2211
-		$this->set_prop( 'name', $name );
2209
+	public function set_name($value) {
2210
+        $name = sanitize_text_field($value);
2211
+		$this->set_prop('name', $name);
2212 2212
     }
2213 2213
 
2214 2214
     /**
@@ -2217,8 +2217,8 @@  discard block
 block discarded – undo
2217 2217
 	 * @since 1.0.19
2218 2218
 	 * @param  string $value New name.
2219 2219
 	 */
2220
-	public function set_title( $value ) {
2221
-		$this->set_name( $value );
2220
+	public function set_title($value) {
2221
+		$this->set_name($value);
2222 2222
     }
2223 2223
 
2224 2224
     /**
@@ -2227,9 +2227,9 @@  discard block
 block discarded – undo
2227 2227
 	 * @since 1.0.19
2228 2228
 	 * @param  string $value New description.
2229 2229
 	 */
2230
-	public function set_description( $value ) {
2231
-        $description = wp_kses_post( $value );
2232
-		$this->set_prop( 'description', $description );
2230
+	public function set_description($value) {
2231
+        $description = wp_kses_post($value);
2232
+		$this->set_prop('description', $description);
2233 2233
     }
2234 2234
 
2235 2235
     /**
@@ -2238,8 +2238,8 @@  discard block
 block discarded – undo
2238 2238
 	 * @since 1.0.19
2239 2239
 	 * @param  string $value New description.
2240 2240
 	 */
2241
-	public function set_excerpt( $value ) {
2242
-		$this->set_description( $value );
2241
+	public function set_excerpt($value) {
2242
+		$this->set_description($value);
2243 2243
     }
2244 2244
 
2245 2245
     /**
@@ -2248,8 +2248,8 @@  discard block
 block discarded – undo
2248 2248
 	 * @since 1.0.19
2249 2249
 	 * @param  string $value New description.
2250 2250
 	 */
2251
-	public function set_summary( $value ) {
2252
-		$this->set_description( $value );
2251
+	public function set_summary($value) {
2252
+		$this->set_description($value);
2253 2253
     }
2254 2254
 
2255 2255
     /**
@@ -2258,12 +2258,12 @@  discard block
 block discarded – undo
2258 2258
 	 * @since 1.0.19
2259 2259
 	 * @param  int $value New author.
2260 2260
 	 */
2261
-	public function set_author( $value ) {
2262
-		$user = get_user_by( 'id', (int) $value );
2261
+	public function set_author($value) {
2262
+		$user = get_user_by('id', (int) $value);
2263 2263
 
2264
-		if ( $user && $user->ID ) {
2265
-			$this->set_prop( 'author', $user->ID );
2266
-			$this->set_prop( 'email', $user->user_email );
2264
+		if ($user && $user->ID) {
2265
+			$this->set_prop('author', $user->ID);
2266
+			$this->set_prop('email', $user->user_email);
2267 2267
 		}
2268 2268
 
2269 2269
     }
@@ -2274,8 +2274,8 @@  discard block
 block discarded – undo
2274 2274
 	 * @since 1.0.19
2275 2275
 	 * @param  int $value New user id.
2276 2276
 	 */
2277
-	public function set_user_id( $value ) {
2278
-		$this->set_author( $value );
2277
+	public function set_user_id($value) {
2278
+		$this->set_author($value);
2279 2279
     }
2280 2280
 
2281 2281
     /**
@@ -2284,8 +2284,8 @@  discard block
 block discarded – undo
2284 2284
 	 * @since 1.0.19
2285 2285
 	 * @param  int $value New user id.
2286 2286
 	 */
2287
-	public function set_customer_id( $value ) {
2288
-		$this->set_author( $value );
2287
+	public function set_customer_id($value) {
2288
+		$this->set_author($value);
2289 2289
     }
2290 2290
 
2291 2291
     /**
@@ -2294,8 +2294,8 @@  discard block
 block discarded – undo
2294 2294
 	 * @since 1.0.19
2295 2295
 	 * @param  string $value ip address.
2296 2296
 	 */
2297
-	public function set_ip( $value ) {
2298
-		$this->set_prop( 'ip', $value );
2297
+	public function set_ip($value) {
2298
+		$this->set_prop('ip', $value);
2299 2299
     }
2300 2300
 
2301 2301
     /**
@@ -2304,8 +2304,8 @@  discard block
 block discarded – undo
2304 2304
 	 * @since 1.0.19
2305 2305
 	 * @param  string $value ip address.
2306 2306
 	 */
2307
-	public function set_user_ip( $value ) {
2308
-		$this->set_ip( $value );
2307
+	public function set_user_ip($value) {
2308
+		$this->set_ip($value);
2309 2309
     }
2310 2310
 
2311 2311
     /**
@@ -2314,8 +2314,8 @@  discard block
 block discarded – undo
2314 2314
 	 * @since 1.0.19
2315 2315
 	 * @param  string $value first name.
2316 2316
 	 */
2317
-	public function set_first_name( $value ) {
2318
-		$this->set_prop( 'first_name', $value );
2317
+	public function set_first_name($value) {
2318
+		$this->set_prop('first_name', $value);
2319 2319
     }
2320 2320
 
2321 2321
     /**
@@ -2324,8 +2324,8 @@  discard block
 block discarded – undo
2324 2324
 	 * @since 1.0.19
2325 2325
 	 * @param  string $value first name.
2326 2326
 	 */
2327
-	public function set_user_first_name( $value ) {
2328
-		$this->set_first_name( $value );
2327
+	public function set_user_first_name($value) {
2328
+		$this->set_first_name($value);
2329 2329
     }
2330 2330
 
2331 2331
     /**
@@ -2334,8 +2334,8 @@  discard block
 block discarded – undo
2334 2334
 	 * @since 1.0.19
2335 2335
 	 * @param  string $value first name.
2336 2336
 	 */
2337
-	public function set_customer_first_name( $value ) {
2338
-		$this->set_first_name( $value );
2337
+	public function set_customer_first_name($value) {
2338
+		$this->set_first_name($value);
2339 2339
     }
2340 2340
 
2341 2341
     /**
@@ -2344,8 +2344,8 @@  discard block
 block discarded – undo
2344 2344
 	 * @since 1.0.19
2345 2345
 	 * @param  string $value last name.
2346 2346
 	 */
2347
-	public function set_last_name( $value ) {
2348
-		$this->set_prop( 'last_name', $value );
2347
+	public function set_last_name($value) {
2348
+		$this->set_prop('last_name', $value);
2349 2349
     }
2350 2350
 
2351 2351
     /**
@@ -2354,8 +2354,8 @@  discard block
 block discarded – undo
2354 2354
 	 * @since 1.0.19
2355 2355
 	 * @param  string $value last name.
2356 2356
 	 */
2357
-	public function set_user_last_name( $value ) {
2358
-		$this->set_last_name( $value );
2357
+	public function set_user_last_name($value) {
2358
+		$this->set_last_name($value);
2359 2359
     }
2360 2360
 
2361 2361
     /**
@@ -2364,8 +2364,8 @@  discard block
 block discarded – undo
2364 2364
 	 * @since 1.0.19
2365 2365
 	 * @param  string $value last name.
2366 2366
 	 */
2367
-	public function set_customer_last_name( $value ) {
2368
-		$this->set_last_name( $value );
2367
+	public function set_customer_last_name($value) {
2368
+		$this->set_last_name($value);
2369 2369
     }
2370 2370
 
2371 2371
     /**
@@ -2374,8 +2374,8 @@  discard block
 block discarded – undo
2374 2374
 	 * @since 1.0.19
2375 2375
 	 * @param  string $value phone.
2376 2376
 	 */
2377
-	public function set_phone( $value ) {
2378
-		$this->set_prop( 'phone', $value );
2377
+	public function set_phone($value) {
2378
+		$this->set_prop('phone', $value);
2379 2379
     }
2380 2380
 
2381 2381
     /**
@@ -2384,8 +2384,8 @@  discard block
 block discarded – undo
2384 2384
 	 * @since 1.0.19
2385 2385
 	 * @param  string $value phone.
2386 2386
 	 */
2387
-	public function set_user_phone( $value ) {
2388
-		$this->set_phone( $value );
2387
+	public function set_user_phone($value) {
2388
+		$this->set_phone($value);
2389 2389
     }
2390 2390
 
2391 2391
     /**
@@ -2394,8 +2394,8 @@  discard block
 block discarded – undo
2394 2394
 	 * @since 1.0.19
2395 2395
 	 * @param  string $value phone.
2396 2396
 	 */
2397
-	public function set_customer_phone( $value ) {
2398
-		$this->set_phone( $value );
2397
+	public function set_customer_phone($value) {
2398
+		$this->set_phone($value);
2399 2399
     }
2400 2400
 
2401 2401
     /**
@@ -2404,8 +2404,8 @@  discard block
 block discarded – undo
2404 2404
 	 * @since 1.0.19
2405 2405
 	 * @param  string $value phone.
2406 2406
 	 */
2407
-	public function set_phone_number( $value ) {
2408
-		$this->set_phone( $value );
2407
+	public function set_phone_number($value) {
2408
+		$this->set_phone($value);
2409 2409
     }
2410 2410
 
2411 2411
     /**
@@ -2414,8 +2414,8 @@  discard block
 block discarded – undo
2414 2414
 	 * @since 1.0.19
2415 2415
 	 * @param  string $value email address.
2416 2416
 	 */
2417
-	public function set_email( $value ) {
2418
-		$this->set_prop( 'email', $value );
2417
+	public function set_email($value) {
2418
+		$this->set_prop('email', $value);
2419 2419
     }
2420 2420
 
2421 2421
     /**
@@ -2424,8 +2424,8 @@  discard block
 block discarded – undo
2424 2424
 	 * @since 1.0.19
2425 2425
 	 * @param  string $value email address.
2426 2426
 	 */
2427
-	public function set_user_email( $value ) {
2428
-		$this->set_email( $value );
2427
+	public function set_user_email($value) {
2428
+		$this->set_email($value);
2429 2429
     }
2430 2430
 
2431 2431
     /**
@@ -2434,8 +2434,8 @@  discard block
 block discarded – undo
2434 2434
 	 * @since 1.0.19
2435 2435
 	 * @param  string $value email address.
2436 2436
 	 */
2437
-	public function set_email_address( $value ) {
2438
-		$this->set_email( $value );
2437
+	public function set_email_address($value) {
2438
+		$this->set_email($value);
2439 2439
     }
2440 2440
 
2441 2441
     /**
@@ -2444,8 +2444,8 @@  discard block
 block discarded – undo
2444 2444
 	 * @since 1.0.19
2445 2445
 	 * @param  string $value email address.
2446 2446
 	 */
2447
-	public function set_customer_email( $value ) {
2448
-		$this->set_email( $value );
2447
+	public function set_customer_email($value) {
2448
+		$this->set_email($value);
2449 2449
     }
2450 2450
 
2451 2451
     /**
@@ -2454,8 +2454,8 @@  discard block
 block discarded – undo
2454 2454
 	 * @since 1.0.19
2455 2455
 	 * @param  string $value country.
2456 2456
 	 */
2457
-	public function set_country( $value ) {
2458
-		$this->set_prop( 'country', $value );
2457
+	public function set_country($value) {
2458
+		$this->set_prop('country', $value);
2459 2459
     }
2460 2460
 
2461 2461
     /**
@@ -2464,8 +2464,8 @@  discard block
 block discarded – undo
2464 2464
 	 * @since 1.0.19
2465 2465
 	 * @param  string $value country.
2466 2466
 	 */
2467
-	public function set_user_country( $value ) {
2468
-		$this->set_country( $value );
2467
+	public function set_user_country($value) {
2468
+		$this->set_country($value);
2469 2469
     }
2470 2470
 
2471 2471
     /**
@@ -2474,8 +2474,8 @@  discard block
 block discarded – undo
2474 2474
 	 * @since 1.0.19
2475 2475
 	 * @param  string $value country.
2476 2476
 	 */
2477
-	public function set_customer_country( $value ) {
2478
-		$this->set_country( $value );
2477
+	public function set_customer_country($value) {
2478
+		$this->set_country($value);
2479 2479
     }
2480 2480
 
2481 2481
     /**
@@ -2484,8 +2484,8 @@  discard block
 block discarded – undo
2484 2484
 	 * @since 1.0.19
2485 2485
 	 * @param  string $value state.
2486 2486
 	 */
2487
-	public function set_state( $value ) {
2488
-		$this->set_prop( 'state', $value );
2487
+	public function set_state($value) {
2488
+		$this->set_prop('state', $value);
2489 2489
     }
2490 2490
 
2491 2491
     /**
@@ -2494,8 +2494,8 @@  discard block
 block discarded – undo
2494 2494
 	 * @since 1.0.19
2495 2495
 	 * @param  string $value state.
2496 2496
 	 */
2497
-	public function set_user_state( $value ) {
2498
-		$this->set_state( $value );
2497
+	public function set_user_state($value) {
2498
+		$this->set_state($value);
2499 2499
     }
2500 2500
 
2501 2501
     /**
@@ -2504,8 +2504,8 @@  discard block
 block discarded – undo
2504 2504
 	 * @since 1.0.19
2505 2505
 	 * @param  string $value state.
2506 2506
 	 */
2507
-	public function set_customer_state( $value ) {
2508
-		$this->set_state( $value );
2507
+	public function set_customer_state($value) {
2508
+		$this->set_state($value);
2509 2509
     }
2510 2510
 
2511 2511
     /**
@@ -2514,8 +2514,8 @@  discard block
 block discarded – undo
2514 2514
 	 * @since 1.0.19
2515 2515
 	 * @param  string $value city.
2516 2516
 	 */
2517
-	public function set_city( $value ) {
2518
-		$this->set_prop( 'city', $value );
2517
+	public function set_city($value) {
2518
+		$this->set_prop('city', $value);
2519 2519
     }
2520 2520
 
2521 2521
     /**
@@ -2524,8 +2524,8 @@  discard block
 block discarded – undo
2524 2524
 	 * @since 1.0.19
2525 2525
 	 * @param  string $value city.
2526 2526
 	 */
2527
-	public function set_user_city( $value ) {
2528
-		$this->set_city( $value );
2527
+	public function set_user_city($value) {
2528
+		$this->set_city($value);
2529 2529
     }
2530 2530
 
2531 2531
     /**
@@ -2534,8 +2534,8 @@  discard block
 block discarded – undo
2534 2534
 	 * @since 1.0.19
2535 2535
 	 * @param  string $value city.
2536 2536
 	 */
2537
-	public function set_customer_city( $value ) {
2538
-		$this->set_city( $value );
2537
+	public function set_customer_city($value) {
2538
+		$this->set_city($value);
2539 2539
     }
2540 2540
 
2541 2541
     /**
@@ -2544,8 +2544,8 @@  discard block
 block discarded – undo
2544 2544
 	 * @since 1.0.19
2545 2545
 	 * @param  string $value zip.
2546 2546
 	 */
2547
-	public function set_zip( $value ) {
2548
-		$this->set_prop( 'zip', $value );
2547
+	public function set_zip($value) {
2548
+		$this->set_prop('zip', $value);
2549 2549
     }
2550 2550
 
2551 2551
     /**
@@ -2554,8 +2554,8 @@  discard block
 block discarded – undo
2554 2554
 	 * @since 1.0.19
2555 2555
 	 * @param  string $value zip.
2556 2556
 	 */
2557
-	public function set_user_zip( $value ) {
2558
-		$this->set_zip( $value );
2557
+	public function set_user_zip($value) {
2558
+		$this->set_zip($value);
2559 2559
     }
2560 2560
 
2561 2561
     /**
@@ -2564,8 +2564,8 @@  discard block
 block discarded – undo
2564 2564
 	 * @since 1.0.19
2565 2565
 	 * @param  string $value zip.
2566 2566
 	 */
2567
-	public function set_customer_zip( $value ) {
2568
-		$this->set_zip( $value );
2567
+	public function set_customer_zip($value) {
2568
+		$this->set_zip($value);
2569 2569
     }
2570 2570
 
2571 2571
     /**
@@ -2574,8 +2574,8 @@  discard block
 block discarded – undo
2574 2574
 	 * @since 1.0.19
2575 2575
 	 * @param  string $value company.
2576 2576
 	 */
2577
-	public function set_company( $value ) {
2578
-		$this->set_prop( 'company', $value );
2577
+	public function set_company($value) {
2578
+		$this->set_prop('company', $value);
2579 2579
     }
2580 2580
 
2581 2581
     /**
@@ -2584,8 +2584,8 @@  discard block
 block discarded – undo
2584 2584
 	 * @since 1.0.19
2585 2585
 	 * @param  string $value company.
2586 2586
 	 */
2587
-	public function set_user_company( $value ) {
2588
-		$this->set_company( $value );
2587
+	public function set_user_company($value) {
2588
+		$this->set_company($value);
2589 2589
     }
2590 2590
 
2591 2591
     /**
@@ -2594,8 +2594,8 @@  discard block
 block discarded – undo
2594 2594
 	 * @since 1.0.19
2595 2595
 	 * @param  string $value company.
2596 2596
 	 */
2597
-	public function set_customer_company( $value ) {
2598
-		$this->set_company( $value );
2597
+	public function set_customer_company($value) {
2598
+		$this->set_company($value);
2599 2599
     }
2600 2600
 
2601 2601
     /**
@@ -2604,8 +2604,8 @@  discard block
 block discarded – undo
2604 2604
 	 * @since 1.0.19
2605 2605
 	 * @param  string $value var number.
2606 2606
 	 */
2607
-	public function set_vat_number( $value ) {
2608
-		$this->set_prop( 'vat_number', $value );
2607
+	public function set_vat_number($value) {
2608
+		$this->set_prop('vat_number', $value);
2609 2609
     }
2610 2610
 
2611 2611
     /**
@@ -2614,8 +2614,8 @@  discard block
 block discarded – undo
2614 2614
 	 * @since 1.0.19
2615 2615
 	 * @param  string $value var number.
2616 2616
 	 */
2617
-	public function set_user_vat_number( $value ) {
2618
-		$this->set_vat_number( $value );
2617
+	public function set_user_vat_number($value) {
2618
+		$this->set_vat_number($value);
2619 2619
     }
2620 2620
 
2621 2621
     /**
@@ -2624,8 +2624,8 @@  discard block
 block discarded – undo
2624 2624
 	 * @since 1.0.19
2625 2625
 	 * @param  string $value var number.
2626 2626
 	 */
2627
-	public function set_customer_vat_number( $value ) {
2628
-		$this->set_vat_number( $value );
2627
+	public function set_customer_vat_number($value) {
2628
+		$this->set_vat_number($value);
2629 2629
     }
2630 2630
 
2631 2631
     /**
@@ -2634,8 +2634,8 @@  discard block
 block discarded – undo
2634 2634
 	 * @since 1.0.19
2635 2635
 	 * @param  string $value var rate.
2636 2636
 	 */
2637
-	public function set_vat_rate( $value ) {
2638
-		$this->set_prop( 'vat_rate', $value );
2637
+	public function set_vat_rate($value) {
2638
+		$this->set_prop('vat_rate', $value);
2639 2639
     }
2640 2640
 
2641 2641
     /**
@@ -2644,8 +2644,8 @@  discard block
 block discarded – undo
2644 2644
 	 * @since 1.0.19
2645 2645
 	 * @param  string $value var number.
2646 2646
 	 */
2647
-	public function set_user_vat_rate( $value ) {
2648
-		$this->set_vat_rate( $value );
2647
+	public function set_user_vat_rate($value) {
2648
+		$this->set_vat_rate($value);
2649 2649
     }
2650 2650
 
2651 2651
     /**
@@ -2654,8 +2654,8 @@  discard block
 block discarded – undo
2654 2654
 	 * @since 1.0.19
2655 2655
 	 * @param  string $value var number.
2656 2656
 	 */
2657
-	public function set_customer_vat_rate( $value ) {
2658
-		$this->set_vat_rate( $value );
2657
+	public function set_customer_vat_rate($value) {
2658
+		$this->set_vat_rate($value);
2659 2659
     }
2660 2660
 
2661 2661
     /**
@@ -2664,8 +2664,8 @@  discard block
 block discarded – undo
2664 2664
 	 * @since 1.0.19
2665 2665
 	 * @param  string $value address.
2666 2666
 	 */
2667
-	public function set_address( $value ) {
2668
-		$this->set_prop( 'address', $value );
2667
+	public function set_address($value) {
2668
+		$this->set_prop('address', $value);
2669 2669
     }
2670 2670
 
2671 2671
     /**
@@ -2674,8 +2674,8 @@  discard block
 block discarded – undo
2674 2674
 	 * @since 1.0.19
2675 2675
 	 * @param  string $value address.
2676 2676
 	 */
2677
-	public function set_user_address( $value ) {
2678
-		$this->set_address( $value );
2677
+	public function set_user_address($value) {
2678
+		$this->set_address($value);
2679 2679
     }
2680 2680
 
2681 2681
     /**
@@ -2684,8 +2684,8 @@  discard block
 block discarded – undo
2684 2684
 	 * @since 1.0.19
2685 2685
 	 * @param  string $value address.
2686 2686
 	 */
2687
-	public function set_customer_address( $value ) {
2688
-		$this->set_address( $value );
2687
+	public function set_customer_address($value) {
2688
+		$this->set_address($value);
2689 2689
     }
2690 2690
 
2691 2691
     /**
@@ -2694,8 +2694,8 @@  discard block
 block discarded – undo
2694 2694
 	 * @since 1.0.19
2695 2695
 	 * @param  int|bool $value confirmed.
2696 2696
 	 */
2697
-	public function set_is_viewed( $value ) {
2698
-		$this->set_prop( 'is_viewed', $value );
2697
+	public function set_is_viewed($value) {
2698
+		$this->set_prop('is_viewed', $value);
2699 2699
 	}
2700 2700
 
2701 2701
 	/**
@@ -2704,8 +2704,8 @@  discard block
 block discarded – undo
2704 2704
 	 * @since 1.0.19
2705 2705
 	 * @param  string $value email recipients.
2706 2706
 	 */
2707
-	public function set_email_cc( $value ) {
2708
-		$this->set_prop( 'email_cc', $value );
2707
+	public function set_email_cc($value) {
2708
+		$this->set_prop('email_cc', $value);
2709 2709
 	}
2710 2710
 
2711 2711
 	/**
@@ -2714,9 +2714,9 @@  discard block
 block discarded – undo
2714 2714
 	 * @since 1.0.19
2715 2715
 	 * @param  string $value template.
2716 2716
 	 */
2717
-	public function set_template( $value ) {
2718
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2719
-			$this->set_prop( 'template', $value );
2717
+	public function set_template($value) {
2718
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2719
+			$this->set_prop('template', $value);
2720 2720
 		}
2721 2721
 	}
2722 2722
 
@@ -2727,8 +2727,8 @@  discard block
 block discarded – undo
2727 2727
 	 * @param  string $value source.
2728 2728
 	 * @deprecated
2729 2729
 	 */
2730
-	public function created_via( $value ) {
2731
-		$this->set_created_via( sanitize_text_field( $value ) );
2730
+	public function created_via($value) {
2731
+		$this->set_created_via(sanitize_text_field($value));
2732 2732
 	}
2733 2733
 
2734 2734
 	/**
@@ -2737,8 +2737,8 @@  discard block
 block discarded – undo
2737 2737
 	 * @since 1.0.19
2738 2738
 	 * @param  string $value source.
2739 2739
 	 */
2740
-	public function set_created_via( $value ) {
2741
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2740
+	public function set_created_via($value) {
2741
+		$this->set_prop('created_via', sanitize_text_field($value));
2742 2742
 	}
2743 2743
 
2744 2744
 	/**
@@ -2747,8 +2747,8 @@  discard block
 block discarded – undo
2747 2747
 	 * @since 1.0.19
2748 2748
 	 * @param  int|bool $value confirmed.
2749 2749
 	 */
2750
-	public function set_address_confirmed( $value ) {
2751
-		$this->set_prop( 'address_confirmed', $value );
2750
+	public function set_address_confirmed($value) {
2751
+		$this->set_prop('address_confirmed', $value);
2752 2752
     }
2753 2753
 
2754 2754
     /**
@@ -2757,8 +2757,8 @@  discard block
 block discarded – undo
2757 2757
 	 * @since 1.0.19
2758 2758
 	 * @param  int|bool $value confirmed.
2759 2759
 	 */
2760
-	public function set_user_address_confirmed( $value ) {
2761
-		$this->set_address_confirmed( $value );
2760
+	public function set_user_address_confirmed($value) {
2761
+		$this->set_address_confirmed($value);
2762 2762
     }
2763 2763
 
2764 2764
     /**
@@ -2767,8 +2767,8 @@  discard block
 block discarded – undo
2767 2767
 	 * @since 1.0.19
2768 2768
 	 * @param  int|bool $value confirmed.
2769 2769
 	 */
2770
-	public function set_customer_address_confirmed( $value ) {
2771
-		$this->set_address_confirmed( $value );
2770
+	public function set_customer_address_confirmed($value) {
2771
+		$this->set_address_confirmed($value);
2772 2772
     }
2773 2773
 
2774 2774
     /**
@@ -2777,8 +2777,8 @@  discard block
 block discarded – undo
2777 2777
 	 * @since 1.0.19
2778 2778
 	 * @param  float $value sub total.
2779 2779
 	 */
2780
-	public function set_subtotal( $value ) {
2781
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2780
+	public function set_subtotal($value) {
2781
+		$this->set_prop('subtotal', max(0, $value));
2782 2782
 	}
2783 2783
 
2784 2784
 	/**
@@ -2787,8 +2787,8 @@  discard block
 block discarded – undo
2787 2787
 	 * @since 1.0.19
2788 2788
 	 * @param  float $value sub total.
2789 2789
 	 */
2790
-	public function set_total( $value ) {
2791
-		$this->set_prop( 'total', max( 0, $value ) );
2790
+	public function set_total($value) {
2791
+		$this->set_prop('total', max(0, $value));
2792 2792
     }
2793 2793
 
2794 2794
     /**
@@ -2797,8 +2797,8 @@  discard block
 block discarded – undo
2797 2797
 	 * @since 1.0.19
2798 2798
 	 * @param  float $value discount total.
2799 2799
 	 */
2800
-	public function set_total_discount( $value ) {
2801
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2800
+	public function set_total_discount($value) {
2801
+		$this->set_prop('total_discount', max(0, $value));
2802 2802
     }
2803 2803
 
2804 2804
     /**
@@ -2807,8 +2807,8 @@  discard block
 block discarded – undo
2807 2807
 	 * @since 1.0.19
2808 2808
 	 * @param  float $value discount total.
2809 2809
 	 */
2810
-	public function set_discount( $value ) {
2811
-		$this->set_total_discount( $value );
2810
+	public function set_discount($value) {
2811
+		$this->set_total_discount($value);
2812 2812
     }
2813 2813
 
2814 2814
     /**
@@ -2817,8 +2817,8 @@  discard block
 block discarded – undo
2817 2817
 	 * @since 1.0.19
2818 2818
 	 * @param  float $value tax total.
2819 2819
 	 */
2820
-	public function set_total_tax( $value ) {
2821
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2820
+	public function set_total_tax($value) {
2821
+		$this->set_prop('total_tax', max(0, $value));
2822 2822
     }
2823 2823
 
2824 2824
     /**
@@ -2827,8 +2827,8 @@  discard block
 block discarded – undo
2827 2827
 	 * @since 1.0.19
2828 2828
 	 * @param  float $value tax total.
2829 2829
 	 */
2830
-	public function set_tax_total( $value ) {
2831
-		$this->set_total_tax( $value );
2830
+	public function set_tax_total($value) {
2831
+		$this->set_total_tax($value);
2832 2832
     }
2833 2833
 
2834 2834
     /**
@@ -2837,8 +2837,8 @@  discard block
 block discarded – undo
2837 2837
 	 * @since 1.0.19
2838 2838
 	 * @param  float $value fees total.
2839 2839
 	 */
2840
-	public function set_total_fees( $value ) {
2841
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2840
+	public function set_total_fees($value) {
2841
+		$this->set_prop('total_fees', max(0, $value));
2842 2842
     }
2843 2843
 
2844 2844
     /**
@@ -2847,8 +2847,8 @@  discard block
 block discarded – undo
2847 2847
 	 * @since 1.0.19
2848 2848
 	 * @param  float $value fees total.
2849 2849
 	 */
2850
-	public function set_fees_total( $value ) {
2851
-		$this->set_total_fees( $value );
2850
+	public function set_fees_total($value) {
2851
+		$this->set_total_fees($value);
2852 2852
     }
2853 2853
 
2854 2854
     /**
@@ -2857,13 +2857,13 @@  discard block
 block discarded – undo
2857 2857
 	 * @since 1.0.19
2858 2858
 	 * @param  array $value fees.
2859 2859
 	 */
2860
-	public function set_fees( $value ) {
2860
+	public function set_fees($value) {
2861 2861
 
2862
-		if ( ! is_array( $value ) ) {
2862
+		if (!is_array($value)) {
2863 2863
 			$value = array();
2864 2864
 		}
2865 2865
 
2866
-		$this->set_prop( 'fees', $value );
2866
+		$this->set_prop('fees', $value);
2867 2867
 
2868 2868
     }
2869 2869
 
@@ -2873,13 +2873,13 @@  discard block
 block discarded – undo
2873 2873
 	 * @since 1.0.19
2874 2874
 	 * @param  array $value taxes.
2875 2875
 	 */
2876
-	public function set_taxes( $value ) {
2876
+	public function set_taxes($value) {
2877 2877
 
2878
-		if ( ! is_array( $value ) ) {
2878
+		if (!is_array($value)) {
2879 2879
 			$value = array();
2880 2880
 		}
2881 2881
 
2882
-		$this->set_prop( 'taxes', $value );
2882
+		$this->set_prop('taxes', $value);
2883 2883
 
2884 2884
     }
2885 2885
 
@@ -2889,13 +2889,13 @@  discard block
 block discarded – undo
2889 2889
 	 * @since 1.0.19
2890 2890
 	 * @param  array $value discounts.
2891 2891
 	 */
2892
-	public function set_discounts( $value ) {
2892
+	public function set_discounts($value) {
2893 2893
 
2894
-		if ( ! is_array( $value ) ) {
2894
+		if (!is_array($value)) {
2895 2895
 			$value = array();
2896 2896
 		}
2897 2897
 
2898
-		$this->set_prop( 'discounts', $value );
2898
+		$this->set_prop('discounts', $value);
2899 2899
     }
2900 2900
 
2901 2901
     /**
@@ -2904,19 +2904,19 @@  discard block
 block discarded – undo
2904 2904
 	 * @since 1.0.19
2905 2905
 	 * @param  GetPaid_Form_Item[] $value items.
2906 2906
 	 */
2907
-	public function set_items( $value ) {
2907
+	public function set_items($value) {
2908 2908
 
2909 2909
         // Remove existing items.
2910
-        $this->set_prop( 'items', array() );
2910
+        $this->set_prop('items', array());
2911 2911
 		$this->recurring_item = null;
2912 2912
 
2913 2913
         // Ensure that we have an array.
2914
-        if ( ! is_array( $value ) ) {
2914
+        if (!is_array($value)) {
2915 2915
             return;
2916 2916
         }
2917 2917
 
2918
-        foreach ( $value as $item ) {
2919
-            $this->add_item( $item );
2918
+        foreach ($value as $item) {
2919
+            $this->add_item($item);
2920 2920
         }
2921 2921
 
2922 2922
     }
@@ -2927,8 +2927,8 @@  discard block
 block discarded – undo
2927 2927
 	 * @since 1.0.19
2928 2928
 	 * @param  int $value payment form.
2929 2929
 	 */
2930
-	public function set_payment_form( $value ) {
2931
-		$this->set_prop( 'payment_form', $value );
2930
+	public function set_payment_form($value) {
2931
+		$this->set_prop('payment_form', $value);
2932 2932
     }
2933 2933
 
2934 2934
     /**
@@ -2937,8 +2937,8 @@  discard block
 block discarded – undo
2937 2937
 	 * @since 1.0.19
2938 2938
 	 * @param  string $value submission id.
2939 2939
 	 */
2940
-	public function set_submission_id( $value ) {
2941
-		$this->set_prop( 'submission_id', $value );
2940
+	public function set_submission_id($value) {
2941
+		$this->set_prop('submission_id', $value);
2942 2942
     }
2943 2943
 
2944 2944
     /**
@@ -2947,8 +2947,8 @@  discard block
 block discarded – undo
2947 2947
 	 * @since 1.0.19
2948 2948
 	 * @param  string $value discount code.
2949 2949
 	 */
2950
-	public function set_discount_code( $value ) {
2951
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
2950
+	public function set_discount_code($value) {
2951
+		$this->set_prop('discount_code', sanitize_text_field($value));
2952 2952
     }
2953 2953
 
2954 2954
     /**
@@ -2957,8 +2957,8 @@  discard block
 block discarded – undo
2957 2957
 	 * @since 1.0.19
2958 2958
 	 * @param  string $value gateway.
2959 2959
 	 */
2960
-	public function set_gateway( $value ) {
2961
-		$this->set_prop( 'gateway', $value );
2960
+	public function set_gateway($value) {
2961
+		$this->set_prop('gateway', $value);
2962 2962
     }
2963 2963
 
2964 2964
     /**
@@ -2967,9 +2967,9 @@  discard block
 block discarded – undo
2967 2967
 	 * @since 1.0.19
2968 2968
 	 * @param  string $value transaction id.
2969 2969
 	 */
2970
-	public function set_transaction_id( $value ) {
2971
-		if ( ! empty( $value ) ) {
2972
-			$this->set_prop( 'transaction_id', $value );
2970
+	public function set_transaction_id($value) {
2971
+		if (!empty($value)) {
2972
+			$this->set_prop('transaction_id', $value);
2973 2973
 		}
2974 2974
     }
2975 2975
 
@@ -2979,8 +2979,8 @@  discard block
 block discarded – undo
2979 2979
 	 * @since 1.0.19
2980 2980
 	 * @param  string $value currency id.
2981 2981
 	 */
2982
-	public function set_currency( $value ) {
2983
-		$this->set_prop( 'currency', $value );
2982
+	public function set_currency($value) {
2983
+		$this->set_prop('currency', $value);
2984 2984
     }
2985 2985
 
2986 2986
 	/**
@@ -2989,8 +2989,8 @@  discard block
 block discarded – undo
2989 2989
 	 * @since 1.0.19
2990 2990
 	 * @param  bool $value value.
2991 2991
 	 */
2992
-	public function set_disable_taxes( $value ) {
2993
-		$this->set_prop( 'disable_taxes', (bool) $value );
2992
+	public function set_disable_taxes($value) {
2993
+		$this->set_prop('disable_taxes', (bool) $value);
2994 2994
 	}
2995 2995
 
2996 2996
     /**
@@ -2999,8 +2999,8 @@  discard block
 block discarded – undo
2999 2999
 	 * @since 1.0.19
3000 3000
 	 * @param  string $value subscription id.
3001 3001
 	 */
3002
-	public function set_subscription_id( $value ) {
3003
-		$this->set_prop( 'subscription_id', $value );
3002
+	public function set_subscription_id($value) {
3003
+		$this->set_prop('subscription_id', $value);
3004 3004
 	}
3005 3005
 	
3006 3006
 	/**
@@ -3009,8 +3009,8 @@  discard block
 block discarded – undo
3009 3009
 	 * @since 1.0.19
3010 3010
 	 * @param  string $value subscription id.
3011 3011
 	 */
3012
-	public function set_remote_subscription_id( $value ) {
3013
-		$this->set_prop( 'remote_subscription_id', $value );
3012
+	public function set_remote_subscription_id($value) {
3013
+		$this->set_prop('remote_subscription_id', $value);
3014 3014
     }
3015 3015
 
3016 3016
     /*
@@ -3027,28 +3027,28 @@  discard block
 block discarded – undo
3027 3027
      */
3028 3028
     public function is_parent() {
3029 3029
         $parent = $this->get_parent_id();
3030
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
3030
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
3031 3031
     }
3032 3032
 
3033 3033
     /**
3034 3034
      * Checks if this is a renewal invoice.
3035 3035
      */
3036 3036
     public function is_renewal() {
3037
-        return ! $this->is_parent();
3037
+        return !$this->is_parent();
3038 3038
     }
3039 3039
 
3040 3040
     /**
3041 3041
      * Checks if this is a recurring invoice.
3042 3042
      */
3043 3043
     public function is_recurring() {
3044
-        return $this->is_renewal() || ! empty( $this->recurring_item );
3044
+        return $this->is_renewal() || !empty($this->recurring_item);
3045 3045
     }
3046 3046
 
3047 3047
     /**
3048 3048
      * Checks if this is a taxable invoice.
3049 3049
      */
3050 3050
     public function is_taxable() {
3051
-        return ! $this->get_disable_taxes();
3051
+        return !$this->get_disable_taxes();
3052 3052
 	}
3053 3053
 
3054 3054
 	/**
@@ -3062,45 +3062,45 @@  discard block
 block discarded – undo
3062 3062
 	 * Checks to see if the invoice requires payment.
3063 3063
 	 */
3064 3064
 	public function is_free() {
3065
-        $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3065
+        $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0);
3066 3066
 
3067
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3067
+		if ($this->is_recurring() && $this->get_recurring_total() > 0) {
3068 3068
 			$is_free = false;
3069 3069
 		}
3070 3070
 
3071
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3071
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
3072 3072
     }
3073 3073
 
3074 3074
     /**
3075 3075
      * Checks if the invoice is paid.
3076 3076
      */
3077 3077
     public function is_paid() {
3078
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3079
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3078
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
3079
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
3080 3080
 	}
3081 3081
 
3082 3082
 	/**
3083 3083
      * Checks if the invoice needs payment.
3084 3084
      */
3085 3085
 	public function needs_payment() {
3086
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3087
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3086
+		$needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free();
3087
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
3088 3088
     }
3089 3089
   
3090 3090
 	/**
3091 3091
      * Checks if the invoice is refunded.
3092 3092
      */
3093 3093
 	public function is_refunded() {
3094
-        $is_refunded = $this->has_status( 'wpi-refunded' );
3095
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3094
+        $is_refunded = $this->has_status('wpi-refunded');
3095
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
3096 3096
 	}
3097 3097
 
3098 3098
 	/**
3099 3099
      * Checks if the invoice is held.
3100 3100
      */
3101 3101
 	public function is_held() {
3102
-        $is_held = $this->has_status( 'wpi-onhold' );
3103
-        return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3102
+        $is_held = $this->has_status('wpi-onhold');
3103
+        return apply_filters('wpinv_invoice_is_held', $is_held, $this);
3104 3104
 	}
3105 3105
 
3106 3106
 	/**
@@ -3108,30 +3108,30 @@  discard block
 block discarded – undo
3108 3108
      */
3109 3109
 	public function is_due() {
3110 3110
 		$due_date = $this->get_due_date();
3111
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3111
+		return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date);
3112 3112
 	}
3113 3113
 
3114 3114
 	/**
3115 3115
      * Checks if the invoice is draft.
3116 3116
      */
3117 3117
 	public function is_draft() {
3118
-        return $this->has_status( 'draft, auto-draft' );
3118
+        return $this->has_status('draft, auto-draft');
3119 3119
 	}
3120 3120
 
3121 3121
     /**
3122 3122
      * Checks if the invoice has a given status.
3123 3123
      */
3124
-    public function has_status( $status ) {
3125
-        $status = wpinv_parse_list( $status );
3126
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3124
+    public function has_status($status) {
3125
+        $status = wpinv_parse_list($status);
3126
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
3127 3127
 	}
3128 3128
 
3129 3129
 	/**
3130 3130
      * Checks if the invoice is of a given type.
3131 3131
      */
3132
-    public function is_type( $type ) {
3133
-        $type = wpinv_parse_list( $type );
3134
-        return in_array( $this->get_type(), $type );
3132
+    public function is_type($type) {
3133
+        $type = wpinv_parse_list($type);
3134
+        return in_array($this->get_type(), $type);
3135 3135
     }
3136 3136
 
3137 3137
     /**
@@ -3163,8 +3163,8 @@  discard block
 block discarded – undo
3163 3163
      *
3164 3164
      */
3165 3165
 	public function is_initial_free() {
3166
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3167
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3166
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
3167
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
3168 3168
     }
3169 3169
 	
3170 3170
 	/**
@@ -3174,11 +3174,11 @@  discard block
 block discarded – undo
3174 3174
     public function item_has_free_trial() {
3175 3175
 
3176 3176
         // Ensure we have a recurring item.
3177
-        if ( ! $this->is_recurring() ) {
3177
+        if (!$this->is_recurring()) {
3178 3178
             return false;
3179 3179
         }
3180 3180
 
3181
-        $item = $this->get_recurring( true );
3181
+        $item = $this->get_recurring(true);
3182 3182
         return $item->has_free_trial();
3183 3183
 	}
3184 3184
 
@@ -3186,7 +3186,7 @@  discard block
 block discarded – undo
3186 3186
      * Check if the free trial is a result of a discount.
3187 3187
      */
3188 3188
     public function is_free_trial_from_discount() {
3189
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3189
+		return $this->has_free_trial() && !$this->item_has_free_trial();
3190 3190
 	}
3191 3191
 	
3192 3192
 	/**
@@ -3194,12 +3194,12 @@  discard block
 block discarded – undo
3194 3194
      */
3195 3195
     public function discount_first_payment_only() {
3196 3196
 
3197
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3198
-        if ( ! $discount->exists() || ! $this->is_recurring() ) {
3197
+		$discount = wpinv_get_discount_obj($this->get_discount_code());
3198
+        if (!$discount->exists() || !$this->is_recurring()) {
3199 3199
             return true;
3200 3200
         }
3201 3201
 
3202
-        return ! $discount->get_is_recurring();
3202
+        return !$discount->get_is_recurring();
3203 3203
     }
3204 3204
 
3205 3205
     /*
@@ -3217,23 +3217,23 @@  discard block
 block discarded – undo
3217 3217
      * @param GetPaid_Form_Item|array $item
3218 3218
      * @return WP_Error|Bool
3219 3219
      */
3220
-    public function add_item( $item ) {
3220
+    public function add_item($item) {
3221 3221
 
3222
-		if ( is_array( $item ) ) {
3223
-			$item = $this->process_array_item( $item );
3222
+		if (is_array($item)) {
3223
+			$item = $this->process_array_item($item);
3224 3224
 		}
3225 3225
 
3226
-		if ( is_numeric( $item ) ) {
3227
-			$item = new GetPaid_Form_Item( $item );
3226
+		if (is_numeric($item)) {
3227
+			$item = new GetPaid_Form_Item($item);
3228 3228
 		}
3229 3229
 
3230 3230
         // Make sure that it is available for purchase.
3231
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3232
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3231
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
3232
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
3233 3233
         }
3234 3234
 
3235 3235
         // Do we have a recurring item?
3236
-		if ( $item->is_recurring() ) {
3236
+		if ($item->is_recurring()) {
3237 3237
 			$this->recurring_item = $item->get_id();
3238 3238
         }
3239 3239
 
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
         $item->invoice_id = (int) $this->get_id();
3242 3242
 
3243 3243
 		// Remove duplicates.
3244
-		$this->remove_item( $item->get_id() );
3244
+		$this->remove_item($item->get_id());
3245 3245
 
3246 3246
 		// Retrieve all items.
3247 3247
         $items   = $this->get_items();
@@ -3249,7 +3249,7 @@  discard block
 block discarded – undo
3249 3249
 		// Add new item.
3250 3250
         $items[] = $item;
3251 3251
 
3252
-        $this->set_prop( 'items', $items );
3252
+        $this->set_prop('items', $items);
3253 3253
 
3254 3254
 		return true;
3255 3255
 	}
@@ -3260,26 +3260,26 @@  discard block
 block discarded – undo
3260 3260
 	 * @since 1.0.19
3261 3261
 	 * @return GetPaid_Form_Item
3262 3262
 	 */
3263
-	protected function process_array_item( $array ) {
3263
+	protected function process_array_item($array) {
3264 3264
 
3265
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3266
-		$item    = new GetPaid_Form_Item( $item_id );
3265
+		$item_id = isset($array['item_id']) ? $array['item_id'] : 0;
3266
+		$item    = new GetPaid_Form_Item($item_id);
3267 3267
 
3268 3268
 		// Set item data.
3269
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3270
-			if ( isset( $array[ "item_$key" ] ) ) {
3269
+		foreach (array('name', 'price', 'description') as $key) {
3270
+			if (isset($array["item_$key"])) {
3271 3271
 				$method = "set_$key";
3272
-				$item->$method( $array[ "item_$key" ] );
3272
+				$item->$method($array["item_$key"]);
3273 3273
 			}
3274 3274
 		}
3275 3275
 
3276
-		if ( isset( $array['quantity'] ) ) {
3277
-			$item->set_quantity( $array['quantity'] );
3276
+		if (isset($array['quantity'])) {
3277
+			$item->set_quantity($array['quantity']);
3278 3278
 		}
3279 3279
 
3280 3280
 		// Set item meta.
3281
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3282
-			$item->set_item_meta( $array['meta'] );
3281
+		if (isset($array['meta']) && is_array($array['meta'])) {
3282
+			$item->set_item_meta($array['meta']);
3283 3283
 		}
3284 3284
 
3285 3285
 		return $item;
@@ -3292,10 +3292,10 @@  discard block
 block discarded – undo
3292 3292
 	 * @since 1.0.19
3293 3293
 	 * @return GetPaid_Form_Item|null
3294 3294
 	 */
3295
-	public function get_item( $item_id ) {
3295
+	public function get_item($item_id) {
3296 3296
 
3297
-		foreach ( $this->get_items() as $item ) {
3298
-			if ( (int) $item_id == $item->get_id() ) {
3297
+		foreach ($this->get_items() as $item) {
3298
+			if ((int) $item_id == $item->get_id()) {
3299 3299
 				return $item;
3300 3300
 			}
3301 3301
 		}
@@ -3308,16 +3308,16 @@  discard block
 block discarded – undo
3308 3308
 	 *
3309 3309
 	 * @since 1.0.19
3310 3310
 	 */
3311
-	public function remove_item( $item_id ) {
3311
+	public function remove_item($item_id) {
3312 3312
 		$items   = $this->get_items();
3313 3313
 		$item_id = (int) $item_id;
3314 3314
 
3315
-		foreach ( $items as $index => $item ) {
3316
-			if ( (int) $item_id == $item->get_id() ) {
3317
-				unset( $items[ $index ] );
3318
-				$this->set_prop( 'items', $items );
3315
+		foreach ($items as $index => $item) {
3316
+			if ((int) $item_id == $item->get_id()) {
3317
+				unset($items[$index]);
3318
+				$this->set_prop('items', $items);
3319 3319
 
3320
-				if ( $item_id == $this->recurring_item ) {
3320
+				if ($item_id == $this->recurring_item) {
3321 3321
 					$this->recurring_item = null;
3322 3322
 				}
3323 3323
 
@@ -3332,11 +3332,11 @@  discard block
 block discarded – undo
3332 3332
 	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3333 3333
 	 * @since 1.0.19
3334 3334
 	 */
3335
-    public function add_fee( $fee ) {
3335
+    public function add_fee($fee) {
3336 3336
 
3337 3337
 		$fees                 = $this->get_fees();
3338
-		$fees[ $fee['name'] ] = $fee;
3339
-		$this->set_prop( 'fees', $fees );
3338
+		$fees[$fee['name']] = $fee;
3339
+		$this->set_prop('fees', $fees);
3340 3340
 
3341 3341
     }
3342 3342
 
@@ -3345,9 +3345,9 @@  discard block
 block discarded – undo
3345 3345
 	 *
3346 3346
 	 * @since 1.0.19
3347 3347
 	 */
3348
-	public function get_fee( $fee ) {
3348
+	public function get_fee($fee) {
3349 3349
         $fees = $this->get_fees();
3350
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3350
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3351 3351
     }
3352 3352
 
3353 3353
     /**
@@ -3355,11 +3355,11 @@  discard block
 block discarded – undo
3355 3355
 	 *
3356 3356
 	 * @since 1.0.19
3357 3357
 	 */
3358
-	public function remove_fee( $fee ) {
3358
+	public function remove_fee($fee) {
3359 3359
         $fees = $this->get_fees();
3360
-        if ( isset( $fees[ $fee ] ) ) {
3361
-            unset( $fees[ $fee ] );
3362
-            $this->set_prop( 'fees', $fees );
3360
+        if (isset($fees[$fee])) {
3361
+            unset($fees[$fee]);
3362
+            $this->set_prop('fees', $fees);
3363 3363
         }
3364 3364
     }
3365 3365
 
@@ -3369,11 +3369,11 @@  discard block
 block discarded – undo
3369 3369
 	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3370 3370
 	 * @since 1.0.19
3371 3371
 	 */
3372
-	public function add_discount( $discount ) {
3372
+	public function add_discount($discount) {
3373 3373
 
3374 3374
 		$discounts = $this->get_discounts();
3375
-		$discounts[ $discount['name'] ] = $discount;
3376
-		$this->set_prop( 'discounts', $discounts );
3375
+		$discounts[$discount['name']] = $discount;
3376
+		$this->set_prop('discounts', $discounts);
3377 3377
 
3378 3378
 	}
3379 3379
 
@@ -3383,15 +3383,15 @@  discard block
 block discarded – undo
3383 3383
 	 * @since 1.0.19
3384 3384
 	 * @return float
3385 3385
 	 */
3386
-	public function get_discount( $discount = false ) {
3386
+	public function get_discount($discount = false) {
3387 3387
 
3388 3388
 		// Backwards compatibilty.
3389
-		if ( empty( $discount ) ) {
3389
+		if (empty($discount)) {
3390 3390
 			return $this->get_total_discount();
3391 3391
 		}
3392 3392
 
3393 3393
         $discounts = $this->get_discounts();
3394
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3394
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3395 3395
     }
3396 3396
 
3397 3397
     /**
@@ -3399,15 +3399,15 @@  discard block
 block discarded – undo
3399 3399
 	 *
3400 3400
 	 * @since 1.0.19
3401 3401
 	 */
3402
-	public function remove_discount( $discount ) {
3402
+	public function remove_discount($discount) {
3403 3403
         $discounts = $this->get_discounts();
3404
-        if ( isset( $discounts[ $discount ] ) ) {
3405
-            unset( $discounts[ $discount ] );
3406
-            $this->set_prop( 'discounts', $discounts );
3404
+        if (isset($discounts[$discount])) {
3405
+            unset($discounts[$discount]);
3406
+            $this->set_prop('discounts', $discounts);
3407 3407
         }
3408 3408
 
3409
-		if ( 'discount_code' == $discount ) {
3410
-			foreach ( $this->get_items() as $item ) {
3409
+		if ('discount_code' == $discount) {
3410
+			foreach ($this->get_items() as $item) {
3411 3411
 				$item->item_discount           = 0;
3412 3412
 				$item->recurring_item_discount = 0;
3413 3413
 			}
@@ -3420,12 +3420,12 @@  discard block
 block discarded – undo
3420 3420
      *
3421 3421
      * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required.
3422 3422
      */
3423
-    public function add_tax( $tax ) {
3424
-        if ( $this->is_taxable() ) {
3423
+    public function add_tax($tax) {
3424
+        if ($this->is_taxable()) {
3425 3425
 
3426
-            $taxes                 = $this->get_taxes();
3427
-			$taxes[ $tax['name'] ] = $tax;
3428
-			$this->set_prop( 'taxes', $tax );
3426
+            $taxes = $this->get_taxes();
3427
+			$taxes[$tax['name']] = $tax;
3428
+			$this->set_prop('taxes', $tax);
3429 3429
 
3430 3430
         }
3431 3431
     }
@@ -3435,15 +3435,15 @@  discard block
 block discarded – undo
3435 3435
 	 *
3436 3436
 	 * @since 1.0.19
3437 3437
 	 */
3438
-	public function get_tax( $tax = null ) {
3438
+	public function get_tax($tax = null) {
3439 3439
 
3440 3440
 		// Backwards compatility.
3441
-		if ( empty( $tax ) ) {
3441
+		if (empty($tax)) {
3442 3442
 			return $this->get_total_tax();
3443 3443
 		}
3444 3444
 
3445 3445
         $taxes = $this->get_taxes();
3446
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3446
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3447 3447
     }
3448 3448
 
3449 3449
     /**
@@ -3451,11 +3451,11 @@  discard block
 block discarded – undo
3451 3451
 	 *
3452 3452
 	 * @since 1.0.19
3453 3453
 	 */
3454
-	public function remove_tax( $tax ) {
3454
+	public function remove_tax($tax) {
3455 3455
         $taxes = $this->get_taxes();
3456
-        if ( isset( $taxes[ $tax ] ) ) {
3457
-            unset( $taxes[ $tax ] );
3458
-            $this->set_prop( 'taxes', $taxes );
3456
+        if (isset($taxes[$tax])) {
3457
+            unset($taxes[$tax]);
3458
+            $this->set_prop('taxes', $taxes);
3459 3459
         }
3460 3460
     }
3461 3461
 
@@ -3466,22 +3466,22 @@  discard block
 block discarded – undo
3466 3466
 	 * @return float The recalculated subtotal
3467 3467
 	 */
3468 3468
 	public function recalculate_subtotal() {
3469
-        $items     = $this->get_items();
3469
+        $items = $this->get_items();
3470 3470
 		$subtotal  = 0;
3471 3471
 		$recurring = 0;
3472 3472
 
3473
-        foreach ( $items as $item ) {
3473
+        foreach ($items as $item) {
3474 3474
 			$subtotal  += $item->get_sub_total();
3475 3475
 			$recurring += $item->get_recurring_sub_total();
3476 3476
         }
3477 3477
 
3478
-		if ( wpinv_prices_include_tax() ) {
3479
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3480
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3478
+		if (wpinv_prices_include_tax()) {
3479
+			$subtotal  = max(0, $subtotal - $this->totals['tax']['initial']);
3480
+			$recurring = max(0, $recurring - $this->totals['tax']['recurring']);
3481 3481
 		}
3482 3482
 
3483 3483
 		$current = $this->is_renewal() ? $recurring : $subtotal;
3484
-		$this->set_subtotal( $current );
3484
+		$this->set_subtotal($current);
3485 3485
 
3486 3486
 		$this->totals['subtotal'] = array(
3487 3487
 			'initial'   => $subtotal,
@@ -3502,14 +3502,14 @@  discard block
 block discarded – undo
3502 3502
 		$discount  = 0;
3503 3503
 		$recurring = 0;
3504 3504
 
3505
-        foreach ( $discounts as $data ) {
3506
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3507
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3505
+        foreach ($discounts as $data) {
3506
+			$discount  += wpinv_sanitize_amount($data['initial_discount']);
3507
+			$recurring += wpinv_sanitize_amount($data['recurring_discount']);
3508 3508
 		}
3509 3509
 
3510 3510
 		$current = $this->is_renewal() ? $recurring : $discount;
3511 3511
 
3512
-		$this->set_total_discount( $current );
3512
+		$this->set_total_discount($current);
3513 3513
 
3514 3514
 		$this->totals['discount'] = array(
3515 3515
 			'initial'   => $discount,
@@ -3530,13 +3530,13 @@  discard block
 block discarded – undo
3530 3530
 
3531 3531
 		// Maybe disable taxes.
3532 3532
 		$vat_number = $this->get_vat_number();
3533
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3533
+		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($this->get_country()) && !empty($vat_number);
3534 3534
 
3535
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3535
+		if (wpinv_is_base_country($this->get_country()) && 'vat_too' == wpinv_get_option('vat_same_country_rule', 'vat_too')) {
3536 3536
 			$skip_tax = false;
3537 3537
 		}
3538 3538
 
3539
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax   ) {
3539
+		if (!wpinv_use_taxes() || $this->get_disable_taxes() || !wpinv_is_country_taxable($this->get_country()) || $skip_tax) {
3540 3540
 
3541 3541
 			$this->totals['tax'] = array(
3542 3542
 				'initial'   => 0,
@@ -3545,38 +3545,38 @@  discard block
 block discarded – undo
3545 3545
 
3546 3546
 			$this->tax_rate = 0;
3547 3547
 
3548
-			$this->set_taxes( array() );
3548
+			$this->set_taxes(array());
3549 3549
 			$current = 0;
3550 3550
 		} else {
3551 3551
 
3552 3552
 			$item_taxes = array();
3553 3553
 
3554
-			foreach ( $this->get_items() as $item ) {
3555
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3556
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3557
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3558
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3559
-				foreach ( $taxes as $name => $amount ) {
3560
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3561
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3562
-
3563
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3564
-						$item_taxes[ $name ] = $tax;
3554
+			foreach ($this->get_items() as $item) {
3555
+				$rates    = getpaid_get_item_tax_rates($item, $this->get_country(), $this->get_state());
3556
+				$rates    = getpaid_filter_item_tax_rates($item, $rates);
3557
+				$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
3558
+				$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
3559
+				foreach ($taxes as $name => $amount) {
3560
+					$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
3561
+					$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
3562
+
3563
+					if (!isset($item_taxes[$name])) {
3564
+						$item_taxes[$name] = $tax;
3565 3565
 						continue;
3566 3566
 					}
3567 3567
 
3568
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3569
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3568
+					$item_taxes[$name]['initial_tax']   += $tax['initial_tax'];
3569
+					$item_taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
3570 3570
 
3571 3571
 				}
3572 3572
 
3573 3573
 			}
3574 3574
 
3575
-			$item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3576
-			$this->set_taxes( $item_taxes );
3575
+			$item_taxes = array_replace($this->get_taxes(), $item_taxes);
3576
+			$this->set_taxes($item_taxes);
3577 3577
 
3578
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3579
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3578
+			$initial_tax   = array_sum(wp_list_pluck($item_taxes, 'initial_tax'));
3579
+			$recurring_tax = array_sum(wp_list_pluck($item_taxes, 'recurring_tax'));
3580 3580
 
3581 3581
 			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3582 3582
 
@@ -3587,7 +3587,7 @@  discard block
 block discarded – undo
3587 3587
 
3588 3588
 		}
3589 3589
 
3590
-		$this->set_total_tax( $current );
3590
+		$this->set_total_tax($current);
3591 3591
 
3592 3592
 		return $current;
3593 3593
 
@@ -3604,20 +3604,20 @@  discard block
 block discarded – undo
3604 3604
 		$fee       = 0;
3605 3605
 		$recurring = 0;
3606 3606
 
3607
-        foreach ( $fees as $data ) {
3608
-			$fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3609
-			$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3607
+        foreach ($fees as $data) {
3608
+			$fee       += wpinv_sanitize_amount($data['initial_fee']);
3609
+			$recurring += wpinv_sanitize_amount($data['recurring_fee']);
3610 3610
 		}
3611 3611
 
3612 3612
 		$current = $this->is_renewal() ? $recurring : $fee;
3613
-		$this->set_total_fees( $current );
3613
+		$this->set_total_fees($current);
3614 3614
 
3615 3615
 		$this->totals['fee'] = array(
3616 3616
 			'initial'   => $fee,
3617 3617
 			'recurring' => $recurring,
3618 3618
 		);
3619 3619
 
3620
-        $this->set_total_fees( $fee );
3620
+        $this->set_total_fees($fee);
3621 3621
         return $current;
3622 3622
     }
3623 3623
 
@@ -3632,7 +3632,7 @@  discard block
 block discarded – undo
3632 3632
         $this->recalculate_total_discount();
3633 3633
 		$this->recalculate_total_tax();
3634 3634
 		$this->recalculate_subtotal();
3635
-		$this->set_total( $this->get_total_tax() + $this->get_total_fees() + $this->get_subtotal() - $this->get_total_discount() );
3635
+		$this->set_total($this->get_total_tax() + $this->get_total_fees() + $this->get_subtotal() - $this->get_total_discount());
3636 3636
 		return $this->get_total();
3637 3637
 	}
3638 3638
 
@@ -3641,7 +3641,7 @@  discard block
 block discarded – undo
3641 3641
 	 */
3642 3642
     public function recalculate_totals() {
3643 3643
         $this->recalculate_total();
3644
-        $this->save( true );
3644
+        $this->save(true);
3645 3645
         return $this;
3646 3646
     }
3647 3647
 
@@ -3659,10 +3659,10 @@  discard block
 block discarded – undo
3659 3659
 	 * @return int|false The new note's ID on success, false on failure.
3660 3660
      *
3661 3661
      */
3662
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3662
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3663 3663
 
3664 3664
         // Bail if no note specified or this invoice is not yet saved.
3665
-        if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) {
3665
+        if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) {
3666 3666
             return false;
3667 3667
         }
3668 3668
 
@@ -3670,23 +3670,23 @@  discard block
 block discarded – undo
3670 3670
 		$author_email = '[email protected]';
3671 3671
 
3672 3672
 		// If this is an admin comment or it has been added by the user.
3673
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3674
-			$user         = get_user_by( 'id', get_current_user_id() );
3673
+		if (is_user_logged_in() && (!$system || $added_by_user)) {
3674
+			$user = get_user_by('id', get_current_user_id());
3675 3675
             $author       = $user->display_name;
3676 3676
             $author_email = $user->user_email;
3677 3677
 		}
3678 3678
 
3679
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3679
+		return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type);
3680 3680
 
3681 3681
 	}
3682 3682
 
3683 3683
 	/**
3684 3684
      * Generates a unique key for the invoice.
3685 3685
      */
3686
-    public function generate_key( $string = '' ) {
3687
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3686
+    public function generate_key($string = '') {
3687
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3688 3688
         return strtolower(
3689
-            $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3689
+            $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3690 3690
         );
3691 3691
     }
3692 3692
 
@@ -3696,11 +3696,11 @@  discard block
 block discarded – undo
3696 3696
     public function generate_number() {
3697 3697
         $number = $this->get_id();
3698 3698
 
3699
-        if ( wpinv_sequential_number_active( $this->get_post_type() ) ) {
3700
-            $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3699
+        if (wpinv_sequential_number_active($this->get_post_type())) {
3700
+            $number = wpinv_get_next_invoice_number($this->get_post_type());
3701 3701
         }
3702 3702
 
3703
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3703
+		return wpinv_format_invoice_number($number, $this->get_post_type());
3704 3704
 
3705 3705
 	}
3706 3706
 
@@ -3713,55 +3713,55 @@  discard block
 block discarded – undo
3713 3713
 		// Reset status transition variable.
3714 3714
 		$this->status_transition = false;
3715 3715
 
3716
-		if ( $status_transition ) {
3716
+		if ($status_transition) {
3717 3717
 			try {
3718 3718
 
3719 3719
 				// Fire a hook for the status change.
3720
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3720
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition);
3721 3721
 
3722 3722
 				// @deprecated this is deprecated and will be removed in the future.
3723
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3723
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3724 3724
 
3725
-				if ( ! empty( $status_transition['from'] ) ) {
3725
+				if (!empty($status_transition['from'])) {
3726 3726
 
3727 3727
 					/* translators: 1: old invoice status 2: new invoice status */
3728
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this  ) );
3728
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from'], $this), wpinv_status_nicename($status_transition['to'], $this));
3729 3729
 
3730 3730
 					// Fire another hook.
3731
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3732
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3731
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this);
3732
+					do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']);
3733 3733
 
3734 3734
 					// @deprecated this is deprecated and will be removed in the future.
3735
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3735
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3736 3736
 
3737 3737
 					// Note the transition occurred.
3738
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3738
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']);
3739 3739
 
3740 3740
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3741 3741
 					if (
3742
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3743
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3742
+						in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3743
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3744 3744
 					) {
3745
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3745
+						do_action('getpaid_invoice_payment_status_changed', $this, $status_transition);
3746 3746
 					}
3747 3747
 
3748 3748
 					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3749 3749
 					if (
3750
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3751
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3750
+						in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3751
+						&& in_array($status_transition['to'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3752 3752
 					) {
3753
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3753
+						do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition);
3754 3754
 					}
3755 3755
 				} else {
3756 3756
 					/* translators: %s: new invoice status */
3757
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this  ) );
3757
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this));
3758 3758
 
3759 3759
 					// Note the transition occurred.
3760
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3760
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3761 3761
 
3762 3762
 				}
3763
-			} catch ( Exception $e ) {
3764
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3763
+			} catch (Exception $e) {
3764
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
3765 3765
 			}
3766 3766
 		}
3767 3767
 	}
@@ -3769,13 +3769,13 @@  discard block
 block discarded – undo
3769 3769
 	/**
3770 3770
 	 * Updates an invoice status.
3771 3771
 	 */
3772
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3772
+	public function update_status($new_status = false, $note = '', $manual = false) {
3773 3773
 
3774 3774
 		// Fires before updating a status.
3775
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3775
+		do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit'));
3776 3776
 
3777 3777
 		// Update the status.
3778
-		$this->set_status( $new_status, $note, $manual );
3778
+		$this->set_status($new_status, $note, $manual);
3779 3779
 
3780 3780
 		// Save the order.
3781 3781
 		return $this->save();
@@ -3786,18 +3786,18 @@  discard block
 block discarded – undo
3786 3786
 	 * @deprecated
3787 3787
 	 */
3788 3788
 	public function refresh_item_ids() {
3789
-        $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
3790
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3789
+        $item_ids = implode(',', array_unique(wp_list_pluck($this->get_cart_details(), 'item_id')));
3790
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
3791 3791
 	}
3792 3792
 
3793 3793
 	/**
3794 3794
 	 * @deprecated
3795 3795
 	 */
3796
-	public function update_items( $temp = false ) {
3796
+	public function update_items($temp = false) {
3797 3797
 
3798
-		$this->set_items( $this->get_items() );
3798
+		$this->set_items($this->get_items());
3799 3799
 
3800
-		if ( ! $temp ) {
3800
+		if (!$temp) {
3801 3801
 			$this->save();
3802 3802
 		}
3803 3803
 
@@ -3811,11 +3811,11 @@  discard block
 block discarded – undo
3811 3811
 
3812 3812
         $discount_code = $this->get_discount_code();
3813 3813
 
3814
-        if ( empty( $discount_code ) ) {
3814
+        if (empty($discount_code)) {
3815 3815
             return false;
3816 3816
         }
3817 3817
 
3818
-        $discount = wpinv_get_discount_obj( $discount_code );
3818
+        $discount = wpinv_get_discount_obj($discount_code);
3819 3819
 
3820 3820
         // Ensure it is active.
3821 3821
         return $discount->exists();
@@ -3826,7 +3826,7 @@  discard block
 block discarded – undo
3826 3826
 	 * Refunds an invoice.
3827 3827
 	 */
3828 3828
     public function refund() {
3829
-		$this->set_status( 'wpi-refunded' );
3829
+		$this->set_status('wpi-refunded');
3830 3830
         $this->save();
3831 3831
 	}
3832 3832
 
@@ -3835,53 +3835,53 @@  discard block
 block discarded – undo
3835 3835
 	 * 
3836 3836
 	 * @param string $transaction_id
3837 3837
 	 */
3838
-    public function mark_paid( $transaction_id = null, $note = '' ) {
3838
+    public function mark_paid($transaction_id = null, $note = '') {
3839 3839
 
3840 3840
 		// Set the transaction id.
3841
-		if ( empty( $transaction_id ) ) {
3841
+		if (empty($transaction_id)) {
3842 3842
 			$transaction_id = $this->generate_key('trans_');
3843 3843
 		}
3844 3844
 
3845
-		if ( ! $this->get_transaction_id() ) {
3846
-			$this->set_transaction_id( $transaction_id );
3845
+		if (!$this->get_transaction_id()) {
3846
+			$this->set_transaction_id($transaction_id);
3847 3847
 		}
3848 3848
 
3849
-		if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3849
+		if ($this->is_paid() && 'wpi-processing' != $this->get_status()) {
3850 3850
 			return $this->save();
3851 3851
 		}
3852 3852
 
3853 3853
 		// Set the completed date.
3854
-		$this->set_date_completed( current_time( 'mysql' ) );
3854
+		$this->set_date_completed(current_time('mysql'));
3855 3855
 
3856 3856
 		// Set the new status.
3857
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
3858
-		if ( $this->is_renewal() ) {
3857
+		$gateway = sanitize_text_field($this->get_gateway_title());
3858
+		if ($this->is_renewal()) {
3859 3859
 
3860
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3861
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3860
+			$_note = wp_sprintf(__('Renewed via %s', 'invoicing'), $gateway);
3861
+			$_note = $_note . empty($note) ? '' : " ($note)";
3862 3862
 
3863
-			if ( 'none' == $this->get_gateway() ) {
3863
+			if ('none' == $this->get_gateway()) {
3864 3864
 				$_note = $note;
3865 3865
 			}
3866 3866
 
3867
-			$this->set_status( 'wpi-renewal', $_note );
3867
+			$this->set_status('wpi-renewal', $_note);
3868 3868
 
3869 3869
 		} else {
3870 3870
 
3871
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3872
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3871
+			$_note = wp_sprintf(__('Paid via %s', 'invoicing'), $gateway);
3872
+			$_note = $_note . empty($note) ? '' : " ($note)";
3873 3873
 
3874
-			if ( 'none' == $this->get_gateway() ) {
3874
+			if ('none' == $this->get_gateway()) {
3875 3875
 				$_note = $note;
3876 3876
 			}
3877 3877
 
3878
-			$this->set_status( 'publish', $_note );
3878
+			$this->set_status('publish', $_note);
3879 3879
 
3880 3880
 		}
3881 3881
 
3882 3882
 		// Set checkout mode.
3883
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
3884
-		$this->set_mode( $mode );
3883
+		$mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live';
3884
+		$this->set_mode($mode);
3885 3885
 
3886 3886
 		// Save the invoice.
3887 3887
         $this->save();
@@ -3906,9 +3906,9 @@  discard block
 block discarded – undo
3906 3906
      * Clears the subscription's cache.
3907 3907
      */
3908 3908
     public function clear_cache() {
3909
-		wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
3910
-		wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
3911
-		wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
3909
+		wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids');
3910
+		wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids');
3911
+		wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
3912 3912
 	}
3913 3913
 
3914 3914
 }
Please login to merge, or discard this patch.
includes/class-wpinv-subscriptions.php 1 patch
Spacing   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 /**
9 9
  * Main Subscriptions class.
10 10
  *
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
     /**
15 15
 	 * Class constructor.
16 16
 	 */
17
-    public function __construct(){
17
+    public function __construct() {
18 18
 
19 19
         // Fire gateway specific hooks when a subscription changes.
20
-        add_action( 'getpaid_subscription_status_changed', array( $this, 'process_subscription_status_change' ), 10, 3 );
20
+        add_action('getpaid_subscription_status_changed', array($this, 'process_subscription_status_change'), 10, 3);
21 21
 
22 22
         // De-activate a subscription whenever the invoice changes payment statuses.
23
-        add_action( 'getpaid_invoice_status_wpi-refunded', array( $this, 'maybe_deactivate_invoice_subscription' ), 20 );
24
-        add_action( 'getpaid_invoice_status_wpi-failed', array( $this, 'maybe_deactivate_invoice_subscription' ), 20 );
25
-        add_action( 'getpaid_invoice_status_wpi-cancelled', array( $this, 'maybe_deactivate_invoice_subscription' ), 20 );
26
-        add_action( 'getpaid_invoice_status_wpi-pending', array( $this, 'maybe_deactivate_invoice_subscription' ), 20 );
23
+        add_action('getpaid_invoice_status_wpi-refunded', array($this, 'maybe_deactivate_invoice_subscription'), 20);
24
+        add_action('getpaid_invoice_status_wpi-failed', array($this, 'maybe_deactivate_invoice_subscription'), 20);
25
+        add_action('getpaid_invoice_status_wpi-cancelled', array($this, 'maybe_deactivate_invoice_subscription'), 20);
26
+        add_action('getpaid_invoice_status_wpi-pending', array($this, 'maybe_deactivate_invoice_subscription'), 20);
27 27
 
28 28
         // Handles subscription cancelations.
29
-        add_action( 'getpaid_authenticated_action_subscription_cancel', array( $this, 'user_cancel_single_subscription' ) );
29
+        add_action('getpaid_authenticated_action_subscription_cancel', array($this, 'user_cancel_single_subscription'));
30 30
 
31 31
         // Create a subscription whenever an invoice is created, (and update it when it is updated).
32
-        add_action( 'getpaid_new_invoice', array( $this, 'maybe_create_invoice_subscription' ), 5 );
33
-        add_action( 'getpaid_update_invoice', array( $this, 'maybe_update_invoice_subscription' ), 5 );
32
+        add_action('getpaid_new_invoice', array($this, 'maybe_create_invoice_subscription'), 5);
33
+        add_action('getpaid_update_invoice', array($this, 'maybe_update_invoice_subscription'), 5);
34 34
 
35 35
         // Handles admin subscription update actions.
36
-        add_action( 'getpaid_authenticated_admin_action_update_single_subscription', array( $this, 'admin_update_single_subscription' ) );
37
-        add_action( 'getpaid_authenticated_admin_action_subscription_manual_renew', array( $this, 'admin_renew_single_subscription' ) );
38
-        add_action( 'getpaid_authenticated_admin_action_subscription_manual_delete', array( $this, 'admin_delete_single_subscription' ) );
36
+        add_action('getpaid_authenticated_admin_action_update_single_subscription', array($this, 'admin_update_single_subscription'));
37
+        add_action('getpaid_authenticated_admin_action_subscription_manual_renew', array($this, 'admin_renew_single_subscription'));
38
+        add_action('getpaid_authenticated_admin_action_subscription_manual_delete', array($this, 'admin_delete_single_subscription'));
39 39
     
40 40
         // Filter invoice item row actions.
41
-        add_action( 'getpaid-invoice-page-line-item-actions', array( $this, 'filter_invoice_line_item_actions' ), 10, 3 );
41
+        add_action('getpaid-invoice-page-line-item-actions', array($this, 'filter_invoice_line_item_actions'), 10, 3);
42 42
     }
43 43
 
44 44
     /**
@@ -47,19 +47,19 @@  discard block
 block discarded – undo
47 47
      * @param WPInv_Invoice $invoice
48 48
      * @return WPInv_Subscription|bool
49 49
      */
50
-    public function get_invoice_subscription( $invoice ) {
50
+    public function get_invoice_subscription($invoice) {
51 51
         $subscription_id = $invoice->get_subscription_id();
52 52
 
53 53
         // Fallback to the parent invoice if the child invoice has no subscription id.
54
-        if ( empty( $subscription_id ) && $invoice->is_renewal() ) {
54
+        if (empty($subscription_id) && $invoice->is_renewal()) {
55 55
             $subscription_id = $invoice->get_parent_payment()->get_subscription_id();
56 56
         }
57 57
 
58 58
         // Fetch the subscription.
59
-        $subscription = new WPInv_Subscription( $subscription_id );
59
+        $subscription = new WPInv_Subscription($subscription_id);
60 60
 
61 61
         // Return subscription or use a fallback for backwards compatibility.
62
-        return $subscription->exists() ? $subscription : wpinv_get_invoice_subscription( $invoice );
62
+        return $subscription->exists() ? $subscription : wpinv_get_invoice_subscription($invoice);
63 63
     }
64 64
 
65 65
     /**
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
      * 
68 68
      * @param WPInv_Invoice $invoice
69 69
      */
70
-    public function maybe_deactivate_invoice_subscription( $invoice ) {
70
+    public function maybe_deactivate_invoice_subscription($invoice) {
71 71
 
72
-        $subscriptions = getpaid_get_invoice_subscriptions( $invoice );
72
+        $subscriptions = getpaid_get_invoice_subscriptions($invoice);
73 73
 
74
-        if ( empty( $subscriptions ) ) {
74
+        if (empty($subscriptions)) {
75 75
             return;
76 76
         }
77 77
 
78
-        if ( ! is_array( $subscriptions ) ) {
79
-            $subscriptions = array( $subscriptions );
78
+        if (!is_array($subscriptions)) {
79
+            $subscriptions = array($subscriptions);
80 80
         }
81 81
 
82
-        foreach ( $subscriptions as $subscription ) {
83
-            if ( $subscription->is_active() ) {
84
-                $subscription->set_status( 'pending' );
82
+        foreach ($subscriptions as $subscription) {
83
+            if ($subscription->is_active()) {
84
+                $subscription->set_status('pending');
85 85
                 $subscription->save();
86 86
             }
87 87
         }
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
      * @param string $from
96 96
      * @param string $to
97 97
 	 */
98
-    public function process_subscription_status_change( $subscription, $from, $to ) {
98
+    public function process_subscription_status_change($subscription, $from, $to) {
99 99
 
100 100
         $gateway = $subscription->get_gateway();
101 101
 
102
-        if ( ! empty( $gateway ) ) {
103
-            $gateway = sanitize_key( $gateway );
104
-            $from    = sanitize_key( $from );
105
-            $to      = sanitize_key( $to );
106
-            do_action( "getpaid_{$gateway}_subscription_$to", $subscription, $from );
102
+        if (!empty($gateway)) {
103
+            $gateway = sanitize_key($gateway);
104
+            $from    = sanitize_key($from);
105
+            $to      = sanitize_key($to);
106
+            do_action("getpaid_{$gateway}_subscription_$to", $subscription, $from);
107 107
         }
108 108
 
109 109
     }
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
      * @deprecated
117 117
      * @return mixed|string|void
118 118
      */
119
-    public static function wpinv_get_pretty_subscription_frequency( $period, $frequency_count = 1 ) {
120
-        return getpaid_get_subscription_period_label( $period, $frequency_count );
119
+    public static function wpinv_get_pretty_subscription_frequency($period, $frequency_count = 1) {
120
+        return getpaid_get_subscription_period_label($period, $frequency_count);
121 121
     }
122 122
 
123 123
     /**
@@ -127,33 +127,33 @@  discard block
 block discarded – undo
127 127
      * @since       1.0.0
128 128
      * @return      void
129 129
      */
130
-    public function user_cancel_single_subscription( $data ) {
130
+    public function user_cancel_single_subscription($data) {
131 131
 
132 132
         // Ensure there is a subscription to cancel.
133
-        if ( empty( $data['subscription'] ) ) {
133
+        if (empty($data['subscription'])) {
134 134
             return;
135 135
         }
136 136
 
137
-        $subscription = new WPInv_Subscription( (int) $data['subscription'] );
137
+        $subscription = new WPInv_Subscription((int) $data['subscription']);
138 138
 
139 139
         // Ensure that it exists and that it belongs to the current user.
140
-        if ( ! $subscription->exists() || $subscription->get_customer_id() != get_current_user_id() ) {
141
-            wpinv_set_error( 'invalid_subscription', __( 'You do not have permission to cancel this subscription', 'invoicing' ) );
140
+        if (!$subscription->exists() || $subscription->get_customer_id() != get_current_user_id()) {
141
+            wpinv_set_error('invalid_subscription', __('You do not have permission to cancel this subscription', 'invoicing'));
142 142
 
143 143
         // Can it be cancelled.
144
-        } else if ( ! $subscription->can_cancel() ) {
145
-            wpinv_set_error( 'cannot_cancel', __( 'This subscription cannot be cancelled as it is not active.', 'invoicing' ) );
144
+        } else if (!$subscription->can_cancel()) {
145
+            wpinv_set_error('cannot_cancel', __('This subscription cannot be cancelled as it is not active.', 'invoicing'));
146 146
 
147 147
         // Cancel it.
148 148
         } else {
149 149
 
150 150
             $subscription->cancel();
151
-            wpinv_set_error( 'cancelled', __( 'This subscription has been cancelled.', 'invoicing' ), 'info' );
151
+            wpinv_set_error('cancelled', __('This subscription has been cancelled.', 'invoicing'), 'info');
152 152
         }
153 153
 
154
-        $redirect = remove_query_arg( array( 'getpaid-action', 'getpaid-nonce' ) );
154
+        $redirect = remove_query_arg(array('getpaid-action', 'getpaid-nonce'));
155 155
 
156
-        wp_safe_redirect( $redirect );
156
+        wp_safe_redirect($redirect);
157 157
         exit;
158 158
 
159 159
     }
@@ -165,41 +165,41 @@  discard block
 block discarded – undo
165 165
      * @param       WPInv_Invoice $invoice
166 166
      * @since       1.0.0
167 167
      */
168
-    public function maybe_create_invoice_subscription( $invoice ) {
168
+    public function maybe_create_invoice_subscription($invoice) {
169 169
         global $getpaid_subscriptions_skip_invoice_update;
170 170
 
171 171
         // Abort if it is not recurring.
172
-        if ( ! $invoice->is_type( 'invoice' ) || $invoice->is_free() || ! $invoice->is_recurring() || $invoice->is_renewal() ) {
172
+        if (!$invoice->is_type('invoice') || $invoice->is_free() || !$invoice->is_recurring() || $invoice->is_renewal()) {
173 173
             return;
174 174
         }
175 175
 
176 176
         // Either group the subscriptions or only process a single suscription.
177
-        if ( getpaid_should_group_subscriptions( $invoice ) ) {
177
+        if (getpaid_should_group_subscriptions($invoice)) {
178 178
 
179 179
             $subscription_groups = array();
180 180
             $is_first            = true;
181 181
 
182
-            foreach ( getpaid_calculate_subscription_totals( $invoice ) as $group_key => $totals ) {
183
-                $subscription_groups[ $group_key ] = $this->create_invoice_subscription_group( $totals, $invoice, 0, $is_first );
182
+            foreach (getpaid_calculate_subscription_totals($invoice) as $group_key => $totals) {
183
+                $subscription_groups[$group_key] = $this->create_invoice_subscription_group($totals, $invoice, 0, $is_first);
184 184
 
185
-                if ( $is_first ) {
185
+                if ($is_first) {
186 186
                     $getpaid_subscriptions_skip_invoice_update = true;
187
-                    $invoice->set_subscription_id( $subscription_groups[ $group_key ]['subscription_id'] );
187
+                    $invoice->set_subscription_id($subscription_groups[$group_key]['subscription_id']);
188 188
                     $invoice->save();
189 189
                     $getpaid_subscriptions_skip_invoice_update = false;
190 190
                 }
191 191
 
192
-                $is_first                          = false;
192
+                $is_first = false;
193 193
             }
194 194
 
195 195
             // Cache subscription groups.
196
-            update_post_meta( $invoice->get_id(), 'getpaid_subscription_groups', $subscription_groups );
196
+            update_post_meta($invoice->get_id(), 'getpaid_subscription_groups', $subscription_groups);
197 197
             return true;
198 198
 
199 199
         }
200 200
 
201 201
         $subscription = new WPInv_Subscription();
202
-        return $this->update_invoice_subscription( $subscription, $invoice );
202
+        return $this->update_invoice_subscription($subscription, $invoice);
203 203
 
204 204
     }
205 205
 
@@ -214,47 +214,47 @@  discard block
 block discarded – undo
214 214
      *
215 215
      * @since       2.3.0
216 216
      */
217
-    public function create_invoice_subscription_group( $totals, $invoice, $subscription_id = 0, $is_first = false ) {
217
+    public function create_invoice_subscription_group($totals, $invoice, $subscription_id = 0, $is_first = false) {
218 218
 
219
-        $subscription  = new WPInv_Subscription( (int) $subscription_id );
219
+        $subscription  = new WPInv_Subscription((int) $subscription_id);
220 220
         $initial_amt   = $totals['initial_total'];
221 221
         $recurring_amt = $totals['recurring_total'];
222 222
         $fees          = array();
223 223
 
224 224
         // Maybe add recurring fees.
225
-        if ( $is_first ) {
225
+        if ($is_first) {
226 226
 
227
-            foreach ( $invoice->get_fees() as $fee ) {
228
-                if ( ! empty( $fee['recurring_fee'] ) ) {
229
-                    $initial_amt   += wpinv_sanitize_amount( $fee['initial_fee'] );
230
-                    $recurring_amt += wpinv_sanitize_amount( $fee['recurring_fee'] );
227
+            foreach ($invoice->get_fees() as $fee) {
228
+                if (!empty($fee['recurring_fee'])) {
229
+                    $initial_amt   += wpinv_sanitize_amount($fee['initial_fee']);
230
+                    $recurring_amt += wpinv_sanitize_amount($fee['recurring_fee']);
231 231
                     $fees[]         = $fee;
232 232
                 }
233 233
             }
234 234
 
235 235
         }
236 236
 
237
-        $subscription->set_customer_id( $invoice->get_customer_id() );
238
-        $subscription->set_parent_invoice_id( $invoice->get_id() );
239
-        $subscription->set_initial_amount( $initial_amt );
240
-        $subscription->set_recurring_amount( $recurring_amt );
241
-        $subscription->set_date_created( current_time( 'mysql' ) );
242
-        $subscription->set_status( $invoice->is_paid() ? 'active' : 'pending' );
243
-        $subscription->set_product_id( $totals['item_id'] );
244
-        $subscription->set_period( $totals['period'] );
245
-        $subscription->set_frequency( $totals['interval'] );
246
-        $subscription->set_bill_times( $totals['recurring_limit'] );
247
-        $subscription->set_next_renewal_date( $totals['renews_on'] );
237
+        $subscription->set_customer_id($invoice->get_customer_id());
238
+        $subscription->set_parent_invoice_id($invoice->get_id());
239
+        $subscription->set_initial_amount($initial_amt);
240
+        $subscription->set_recurring_amount($recurring_amt);
241
+        $subscription->set_date_created(current_time('mysql'));
242
+        $subscription->set_status($invoice->is_paid() ? 'active' : 'pending');
243
+        $subscription->set_product_id($totals['item_id']);
244
+        $subscription->set_period($totals['period']);
245
+        $subscription->set_frequency($totals['interval']);
246
+        $subscription->set_bill_times($totals['recurring_limit']);
247
+        $subscription->set_next_renewal_date($totals['renews_on']);
248 248
 
249 249
         // Trial periods.
250
-        if ( ! empty( $totals['trialling'] ) ) {
251
-            $subscription->set_trial_period( $totals['trialling'] );
252
-            $subscription->set_status( 'trialling' );
250
+        if (!empty($totals['trialling'])) {
251
+            $subscription->set_trial_period($totals['trialling']);
252
+            $subscription->set_status('trialling');
253 253
 
254 254
         // If initial amount is free, treat it as a free trial even if the subscription item does not have a free trial.
255
-        } else if ( empty( $initial_amt ) ) {
256
-            $subscription->set_trial_period( $totals['interval'] . ' ' . $totals['period'] );
257
-            $subscription->set_status( 'trialling' );
255
+        } else if (empty($initial_amt)) {
256
+            $subscription->set_trial_period($totals['interval'] . ' ' . $totals['period']);
257
+            $subscription->set_status('trialling');
258 258
         }
259 259
 
260 260
         $subscription->save();
@@ -272,87 +272,87 @@  discard block
 block discarded – undo
272 272
      * @param       WPInv_Invoice $invoice
273 273
      * @since       1.0.19
274 274
      */
275
-    public function maybe_update_invoice_subscription( $invoice ) {
275
+    public function maybe_update_invoice_subscription($invoice) {
276 276
         global $getpaid_subscriptions_skip_invoice_update;
277 277
 
278 278
         // Avoid infinite loops.
279
-        if ( ! empty( $getpaid_subscriptions_skip_invoice_update ) ) {
279
+        if (!empty($getpaid_subscriptions_skip_invoice_update)) {
280 280
             return;
281 281
         }
282 282
 
283 283
         // Do not process renewals.
284
-        if ( $invoice->is_renewal() ) {
284
+        if ($invoice->is_renewal()) {
285 285
             return;
286 286
         }
287 287
 
288 288
         // Delete existing subscriptions if available and the invoice is not recurring.
289
-        if ( ! $invoice->is_recurring() ) {
290
-            $this->delete_invoice_subscriptions( $invoice );
289
+        if (!$invoice->is_recurring()) {
290
+            $this->delete_invoice_subscriptions($invoice);
291 291
             return;
292 292
         }
293 293
 
294 294
         // Fetch existing subscriptions.
295
-        $subscriptions = getpaid_get_invoice_subscriptions( $invoice );
295
+        $subscriptions = getpaid_get_invoice_subscriptions($invoice);
296 296
 
297 297
         // Create new ones if no existing subscriptions.
298
-        if ( empty( $subscriptions ) ) {
299
-            return $this->maybe_create_invoice_subscription( $invoice );
298
+        if (empty($subscriptions)) {
299
+            return $this->maybe_create_invoice_subscription($invoice);
300 300
         }
301 301
 
302 302
         // Abort if an invoice is paid and already has a subscription.
303
-        if ( $invoice->is_paid() || $invoice->is_refunded() ) {
303
+        if ($invoice->is_paid() || $invoice->is_refunded()) {
304 304
             return;
305 305
         }
306 306
 
307
-        $is_grouped   = is_array( $subscriptions );
308
-        $should_group = getpaid_should_group_subscriptions( $invoice );
307
+        $is_grouped   = is_array($subscriptions);
308
+        $should_group = getpaid_should_group_subscriptions($invoice);
309 309
 
310 310
         // Ensure that the subscriptions are only grouped if there are more than 1 recurring items.
311
-        if ( $is_grouped != $should_group ) {
312
-            $this->delete_invoice_subscriptions( $invoice );
313
-            delete_post_meta( $invoice->get_id(), 'getpaid_subscription_groups' );
314
-            return $this->maybe_create_invoice_subscription( $invoice );
311
+        if ($is_grouped != $should_group) {
312
+            $this->delete_invoice_subscriptions($invoice);
313
+            delete_post_meta($invoice->get_id(), 'getpaid_subscription_groups');
314
+            return $this->maybe_create_invoice_subscription($invoice);
315 315
         }
316 316
 
317 317
         // If there is only one recurring item...
318
-        if ( ! $is_grouped ) {
319
-            return $this->update_invoice_subscription( $subscriptions, $invoice );
318
+        if (!$is_grouped) {
319
+            return $this->update_invoice_subscription($subscriptions, $invoice);
320 320
         }
321 321
 
322 322
         // Process subscription groups.
323
-        $current_groups      = getpaid_get_invoice_subscription_groups( $invoice->get_id() );
323
+        $current_groups      = getpaid_get_invoice_subscription_groups($invoice->get_id());
324 324
         $subscription_groups = array();
325 325
         $is_first            = true;
326 326
 
327 327
         // Create new subscription groups.
328
-        foreach ( getpaid_calculate_subscription_totals( $invoice ) as $group_key => $totals ) {
329
-            $subscription_id                   = isset( $current_groups[ $group_key ] ) ? $current_groups[ $group_key ]['subscription_id'] : 0;
330
-            $subscription_groups[ $group_key ] = $this->create_invoice_subscription_group( $totals, $invoice, $subscription_id, $is_first );
328
+        foreach (getpaid_calculate_subscription_totals($invoice) as $group_key => $totals) {
329
+            $subscription_id                   = isset($current_groups[$group_key]) ? $current_groups[$group_key]['subscription_id'] : 0;
330
+            $subscription_groups[$group_key] = $this->create_invoice_subscription_group($totals, $invoice, $subscription_id, $is_first);
331 331
 
332
-            if ( $is_first && $invoice->get_subscription_id() !== $subscription_groups[ $group_key ]['subscription_id'] ) {
332
+            if ($is_first && $invoice->get_subscription_id() !== $subscription_groups[$group_key]['subscription_id']) {
333 333
                 $getpaid_subscriptions_skip_invoice_update = true;
334
-                $invoice->set_subscription_id( $subscription_groups[ $group_key ]['subscription_id'] );
334
+                $invoice->set_subscription_id($subscription_groups[$group_key]['subscription_id']);
335 335
                 $invoice->save();
336 336
                 $getpaid_subscriptions_skip_invoice_update = false;
337 337
             }
338 338
 
339
-            $is_first                          = false;
339
+            $is_first = false;
340 340
         }
341 341
 
342 342
         // Delete non-existent subscription groups.
343
-        foreach ( $current_groups as $group_key => $data ) {
344
-            if ( ! isset( $subscription_groups[ $group_key ] ) ) {
345
-                $subscription = new WPInv_Subscription( (int) $data['subscription_id'] );
343
+        foreach ($current_groups as $group_key => $data) {
344
+            if (!isset($subscription_groups[$group_key])) {
345
+                $subscription = new WPInv_Subscription((int) $data['subscription_id']);
346 346
 
347
-                if ( $subscription->exists() ) {
348
-                    $subscription->delete( true );
347
+                if ($subscription->exists()) {
348
+                    $subscription->delete(true);
349 349
                 }
350 350
 
351 351
             }
352 352
         }
353 353
 
354 354
         // Cache subscription groups.
355
-        update_post_meta( $invoice->get_id(), 'getpaid_subscription_groups', $subscription_groups );
355
+        update_post_meta($invoice->get_id(), 'getpaid_subscription_groups', $subscription_groups);
356 356
         return true;
357 357
 
358 358
     }
@@ -362,20 +362,20 @@  discard block
 block discarded – undo
362 362
      *
363 363
      * @param WPInv_Invoice $invoice
364 364
      */
365
-    public function delete_invoice_subscriptions( $invoice ) {
365
+    public function delete_invoice_subscriptions($invoice) {
366 366
 
367
-        $subscriptions = getpaid_get_invoice_subscriptions( $invoice );
367
+        $subscriptions = getpaid_get_invoice_subscriptions($invoice);
368 368
 
369
-        if ( empty( $subscriptions ) ) {
369
+        if (empty($subscriptions)) {
370 370
             return;
371 371
         }
372 372
 
373
-        if ( ! is_array( $subscriptions ) ) {
374
-            $subscriptions = array( $subscriptions );
373
+        if (!is_array($subscriptions)) {
374
+            $subscriptions = array($subscriptions);
375 375
         }
376 376
 
377
-        foreach ( $subscriptions as $subscription ) {
378
-            $subscription->delete( true );
377
+        foreach ($subscriptions as $subscription) {
378
+            $subscription->delete(true);
379 379
         }
380 380
 
381 381
     }
@@ -388,57 +388,57 @@  discard block
 block discarded – undo
388 388
      * @param       WPInv_Invoice $invoice
389 389
      * @since       1.0.19
390 390
      */
391
-    public function update_invoice_subscription( $subscription, $invoice ) {
391
+    public function update_invoice_subscription($subscription, $invoice) {
392 392
 
393 393
         // Delete the subscription if an invoice is free or nolonger recurring.
394
-        if ( ! $invoice->is_type( 'invoice' ) || $invoice->is_free() || ! $invoice->is_recurring() ) {
394
+        if (!$invoice->is_type('invoice') || $invoice->is_free() || !$invoice->is_recurring()) {
395 395
             return $subscription->delete();
396 396
         }
397 397
 
398
-        $subscription->set_customer_id( $invoice->get_customer_id() );
399
-        $subscription->set_parent_invoice_id( $invoice->get_id() );
400
-        $subscription->set_initial_amount( $invoice->get_initial_total() );
401
-        $subscription->set_recurring_amount( $invoice->get_recurring_total() );
402
-        $subscription->set_date_created( current_time( 'mysql' ) );
403
-        $subscription->set_status( $invoice->is_paid() ? 'active' : 'pending' );
398
+        $subscription->set_customer_id($invoice->get_customer_id());
399
+        $subscription->set_parent_invoice_id($invoice->get_id());
400
+        $subscription->set_initial_amount($invoice->get_initial_total());
401
+        $subscription->set_recurring_amount($invoice->get_recurring_total());
402
+        $subscription->set_date_created(current_time('mysql'));
403
+        $subscription->set_status($invoice->is_paid() ? 'active' : 'pending');
404 404
 
405 405
         // Get the recurring item and abort if it does not exist.
406
-        $subscription_item = $invoice->get_recurring( true );
407
-        if ( ! $subscription_item->get_id() ) {
406
+        $subscription_item = $invoice->get_recurring(true);
407
+        if (!$subscription_item->get_id()) {
408 408
             $invoice->set_subscription_id(0);
409 409
             $invoice->save();
410 410
             return $subscription->delete();
411 411
         }
412 412
 
413
-        $subscription->set_product_id( $subscription_item->get_id() );
414
-        $subscription->set_period( $subscription_item->get_recurring_period( true ) );
415
-        $subscription->set_frequency( $subscription_item->get_recurring_interval() );
416
-        $subscription->set_bill_times( $subscription_item->get_recurring_limit() );
413
+        $subscription->set_product_id($subscription_item->get_id());
414
+        $subscription->set_period($subscription_item->get_recurring_period(true));
415
+        $subscription->set_frequency($subscription_item->get_recurring_interval());
416
+        $subscription->set_bill_times($subscription_item->get_recurring_limit());
417 417
 
418 418
         // Calculate the next renewal date.
419
-        $period       = $subscription_item->get_recurring_period( true );
419
+        $period       = $subscription_item->get_recurring_period(true);
420 420
         $interval     = $subscription_item->get_recurring_interval();
421 421
 
422 422
         // If the subscription item has a trial period...
423
-        if ( $subscription_item->has_free_trial() ) {
424
-            $period   = $subscription_item->get_trial_period( true );
423
+        if ($subscription_item->has_free_trial()) {
424
+            $period   = $subscription_item->get_trial_period(true);
425 425
             $interval = $subscription_item->get_trial_interval();
426
-            $subscription->set_trial_period( $interval . ' ' . $period );
427
-            $subscription->set_status( 'trialling' );
426
+            $subscription->set_trial_period($interval . ' ' . $period);
427
+            $subscription->set_status('trialling');
428 428
         }
429 429
 
430 430
         // If initial amount is free, treat it as a free trial even if the subscription item does not have a free trial.
431
-        if ( $invoice->has_free_trial() ) {
432
-            $subscription->set_trial_period( $interval . ' ' . $period );
433
-            $subscription->set_status( 'trialling' );
431
+        if ($invoice->has_free_trial()) {
432
+            $subscription->set_trial_period($interval . ' ' . $period);
433
+            $subscription->set_status('trialling');
434 434
         }
435 435
 
436 436
         // Calculate the next renewal date.
437
-        $expiration = date( 'Y-m-d H:i:s', strtotime( "+$interval $period", strtotime( $subscription->get_date_created() ) ) );
437
+        $expiration = date('Y-m-d H:i:s', strtotime("+$interval $period", strtotime($subscription->get_date_created())));
438 438
 
439
-        $subscription->set_next_renewal_date( $expiration );
439
+        $subscription->set_next_renewal_date($expiration);
440 440
         $subscription->save();
441
-        $invoice->set_subscription_id( $subscription->get_id() );
441
+        $invoice->set_subscription_id($subscription->get_id());
442 442
         return $subscription->get_id();
443 443
 
444 444
     }
@@ -449,27 +449,27 @@  discard block
 block discarded – undo
449 449
      * @param       array $data
450 450
      * @since       1.0.19
451 451
      */
452
-    public function admin_update_single_subscription( $args ) {
452
+    public function admin_update_single_subscription($args) {
453 453
 
454 454
         // Ensure the subscription exists and that a status has been given.
455
-        if ( empty( $args['subscription_id'] ) ) {
455
+        if (empty($args['subscription_id'])) {
456 456
             return;
457 457
         }
458 458
 
459 459
         // Retrieve the subscriptions.
460
-        $subscription = new WPInv_Subscription( $args['subscription_id'] );
460
+        $subscription = new WPInv_Subscription($args['subscription_id']);
461 461
 
462
-        if ( $subscription->get_id() ) {
462
+        if ($subscription->get_id()) {
463 463
 
464 464
             $subscription->set_props(
465 465
                 array(
466
-                    'status'     => isset( $args['subscription_status'] ) ? $args['subscription_status'] : null,
467
-                    'profile_id' => isset( $args['wpinv_subscription_profile_id'] ) ? $args['wpinv_subscription_profile_id'] : null,
466
+                    'status'     => isset($args['subscription_status']) ? $args['subscription_status'] : null,
467
+                    'profile_id' => isset($args['wpinv_subscription_profile_id']) ? $args['wpinv_subscription_profile_id'] : null,
468 468
                 )
469 469
             );
470 470
 
471 471
             $subscription->save();
472
-            getpaid_admin()->show_info( __( 'Subscription updated', 'invoicing' ) );
472
+            getpaid_admin()->show_info(__('Subscription updated', 'invoicing'));
473 473
 
474 474
         }
475 475
 
@@ -481,27 +481,27 @@  discard block
 block discarded – undo
481 481
      * @param       array $data
482 482
      * @since       1.0.19
483 483
      */
484
-    public function admin_renew_single_subscription( $args ) {
484
+    public function admin_renew_single_subscription($args) {
485 485
 
486 486
         // Ensure the subscription exists and that a status has been given.
487
-        if ( empty( $args['id'] ) ) {
487
+        if (empty($args['id'])) {
488 488
             return;
489 489
         }
490 490
 
491 491
         // Retrieve the subscriptions.
492
-        $subscription = new WPInv_Subscription( $args['id'] );
492
+        $subscription = new WPInv_Subscription($args['id']);
493 493
 
494
-        if ( $subscription->get_id() ) {
494
+        if ($subscription->get_id()) {
495 495
 
496
-            do_action( 'getpaid_admin_renew_subscription', $subscription );
496
+            do_action('getpaid_admin_renew_subscription', $subscription);
497 497
 
498
-            $args = array( 'transaction_id', $subscription->get_parent_invoice()->generate_key( 'renewal_' ) );
498
+            $args = array('transaction_id', $subscription->get_parent_invoice()->generate_key('renewal_'));
499 499
 
500
-            if ( ! $subscription->add_payment( $args ) ) {
501
-                getpaid_admin()->show_error( __( 'We are unable to renew this subscription as the parent invoice does not exist.', 'invoicing' ) );
500
+            if (!$subscription->add_payment($args)) {
501
+                getpaid_admin()->show_error(__('We are unable to renew this subscription as the parent invoice does not exist.', 'invoicing'));
502 502
             } else {
503 503
                 $subscription->renew();
504
-                getpaid_admin()->show_info( __( 'This subscription has been renewed and extended.', 'invoicing' ) );
504
+                getpaid_admin()->show_info(__('This subscription has been renewed and extended.', 'invoicing'));
505 505
             } 
506 506
 
507 507
             wp_safe_redirect(
@@ -524,20 +524,20 @@  discard block
 block discarded – undo
524 524
      * @param       array $data
525 525
      * @since       1.0.19
526 526
      */
527
-    public function admin_delete_single_subscription( $args ) {
527
+    public function admin_delete_single_subscription($args) {
528 528
 
529 529
         // Ensure the subscription exists and that a status has been given.
530
-        if ( empty( $args['id'] ) ) {
530
+        if (empty($args['id'])) {
531 531
             return;
532 532
         }
533 533
 
534 534
         // Retrieve the subscriptions.
535
-        $subscription = new WPInv_Subscription( $args['id'] );
535
+        $subscription = new WPInv_Subscription($args['id']);
536 536
 
537
-        if ( $subscription->delete() ) {
538
-            getpaid_admin()->show_info( __( 'This subscription has been deleted.', 'invoicing' ) );
537
+        if ($subscription->delete()) {
538
+            getpaid_admin()->show_info(__('This subscription has been deleted.', 'invoicing'));
539 539
         } else {
540
-            getpaid_admin()->show_error( __( 'We are unable to delete this subscription. Please try again.', 'invoicing' ) );
540
+            getpaid_admin()->show_error(__('We are unable to delete this subscription. Please try again.', 'invoicing'));
541 541
         }
542 542
     
543 543
         $redirected = wp_safe_redirect(
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             )
551 551
         );
552 552
 
553
-        if ( $redirected ) {
553
+        if ($redirected) {
554 554
             exit;
555 555
         }
556 556
 
@@ -563,10 +563,10 @@  discard block
 block discarded – undo
563 563
      * @param WPInv_Item $item
564 564
      * @param WPInv_Invoice $invoice
565 565
      */
566
-    public function filter_invoice_line_item_actions( $actions, $item, $invoice ) {
566
+    public function filter_invoice_line_item_actions($actions, $item, $invoice) {
567 567
 
568 568
         // Fetch item subscription.
569
-        $args  = array(
569
+        $args = array(
570 570
             'invoice_in'  => $invoice->is_parent() ? $invoice->get_id() : $invoice->get_parent_id(),
571 571
             'product_in'  => $item->get_id(),
572 572
             'number'      => 1,
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
             'fields'      => 'id',
575 575
         );
576 576
 
577
-        $subscription = new GetPaid_Subscriptions_Query( $args );
577
+        $subscription = new GetPaid_Subscriptions_Query($args);
578 578
         $subscription = $subscription->get_results();
579 579
 
580 580
         // In case we found a match...
581
-        if ( ! empty( $subscription ) ) {
582
-            $url                     = esc_url( add_query_arg( 'subscription', (int) $subscription[0], get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) );
583
-            $actions['subscription'] = "<a href='$url' class='text-decoration-none'>" . __( 'Manage Subscription', 'invoicing' ) . '</a>';
581
+        if (!empty($subscription)) {
582
+            $url                     = esc_url(add_query_arg('subscription', (int) $subscription[0], get_permalink((int) wpinv_get_option('invoice_subscription_page'))));
583
+            $actions['subscription'] = "<a href='$url' class='text-decoration-none'>" . __('Manage Subscription', 'invoicing') . '</a>';
584 584
         }
585 585
 
586 586
         return $actions;
Please login to merge, or discard this patch.
includes/admin/subscriptions.php 1 patch
Spacing   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Contains functions that display the subscriptions admin page.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * Render the Subscriptions page
@@ -17,22 +17,22 @@  discard block
 block discarded – undo
17 17
 	?>
18 18
 
19 19
 	<div class="wrap">
20
-		<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
20
+		<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
21 21
 		<div class="bsui">
22 22
 
23 23
 			<?php
24 24
 
25 25
 				// Verify user permissions.
26
-				if ( ! wpinv_current_user_can_manage_invoicing() ) {
26
+				if (!wpinv_current_user_can_manage_invoicing()) {
27 27
 
28 28
 					echo aui()->alert(
29 29
 						array(
30 30
 							'type'    => 'danger',
31
-							'content' => __( 'You are not permitted to view this page.', 'invoicing' ),
31
+							'content' => __('You are not permitted to view this page.', 'invoicing'),
32 32
 						)
33 33
 					);
34 34
 
35
-				} else if ( ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) {
35
+				} else if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
36 36
 
37 37
 					// Display a single subscription.
38 38
 					wpinv_recurring_subscription_details();
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 function wpinv_recurring_subscription_details() {
82 82
 
83 83
 	// Fetch the subscription.
84
-	$sub = new WPInv_Subscription( (int) $_GET['id'] );
85
-	if ( ! $sub->exists() ) {
84
+	$sub = new WPInv_Subscription((int) $_GET['id']);
85
+	if (!$sub->exists()) {
86 86
 
87 87
 		echo aui()->alert(
88 88
 			array(
89 89
 				'type'    => 'danger',
90
-				'content' => __( 'Subscription not found.', 'invoicing' ),
90
+				'content' => __('Subscription not found.', 'invoicing'),
91 91
 			)
92 92
 		);
93 93
 
@@ -95,45 +95,45 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 
97 97
 	// Use metaboxes to display the subscription details.
98
-	add_meta_box( 'getpaid_admin_subscription_details_metabox', __( 'Subscription Details', 'invoicing' ), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high' );
99
-	add_meta_box( 'getpaid_admin_subscription_update_metabox', __( 'Change Status', 'invoicing' ), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side' );
98
+	add_meta_box('getpaid_admin_subscription_details_metabox', __('Subscription Details', 'invoicing'), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high');
99
+	add_meta_box('getpaid_admin_subscription_update_metabox', __('Change Status', 'invoicing'), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side');
100 100
 
101 101
 	$subscription_id     = $sub->get_id();
102
-	$subscription_groups = getpaid_get_invoice_subscription_groups( $sub->get_parent_invoice_id() );
103
-	$subscription_group  = wp_list_filter( $subscription_groups, compact( 'subscription_id' ) );
102
+	$subscription_groups = getpaid_get_invoice_subscription_groups($sub->get_parent_invoice_id());
103
+	$subscription_group  = wp_list_filter($subscription_groups, compact('subscription_id'));
104 104
 
105
-	if ( 1 < count( $subscription_groups ) ) {
106
-		add_meta_box( 'getpaid_admin_subscription_related_subscriptions_metabox', __( 'Related Subscriptions', 'invoicing' ), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced' );
105
+	if (1 < count($subscription_groups)) {
106
+		add_meta_box('getpaid_admin_subscription_related_subscriptions_metabox', __('Related Subscriptions', 'invoicing'), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced');
107 107
 	}
108 108
 
109
-	if ( ! empty( $subscription_group ) ) {
110
-		add_meta_box( 'getpaid_admin_subscription_item_details_metabox', __( 'Subscription Items', 'invoicing' ), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low' );
109
+	if (!empty($subscription_group)) {
110
+		add_meta_box('getpaid_admin_subscription_item_details_metabox', __('Subscription Items', 'invoicing'), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low');
111 111
 	}
112 112
 
113
-	add_meta_box( 'getpaid_admin_subscription_invoice_details_metabox', __( 'Related Invoices', 'invoicing' ), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced' );
113
+	add_meta_box('getpaid_admin_subscription_invoice_details_metabox', __('Related Invoices', 'invoicing'), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced');
114 114
 
115
-	do_action( 'getpaid_admin_single_subscription_register_metabox', $sub );
115
+	do_action('getpaid_admin_single_subscription_register_metabox', $sub);
116 116
 
117 117
 	?>
118 118
 
119
-		<form method="post" action="<?php echo admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $sub->get_id() ) ); ?>">
119
+		<form method="post" action="<?php echo admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($sub->get_id())); ?>">
120 120
 
121
-			<?php wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); ?>
122
-			<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
123
-			<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
121
+			<?php wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); ?>
122
+			<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
123
+			<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
124 124
 			<input type="hidden" name="getpaid-admin-action" value="update_single_subscription" />
125
-			<input type="hidden" name="subscription_id" value="<?php echo (int) $sub->get_id() ;?>" />
125
+			<input type="hidden" name="subscription_id" value="<?php echo (int) $sub->get_id(); ?>" />
126 126
 
127 127
 			<div id="poststuff">
128 128
 				<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
129 129
 
130 130
 					<div id="postbox-container-1" class="postbox-container">
131
-						<?php do_meta_boxes( get_current_screen(), 'side', $sub ); ?>
131
+						<?php do_meta_boxes(get_current_screen(), 'side', $sub); ?>
132 132
 					</div>
133 133
 
134 134
 					<div id="postbox-container-2" class="postbox-container">
135
-						<?php do_meta_boxes( get_current_screen(), 'normal', $sub ); ?>
136
-						<?php do_meta_boxes( get_current_screen(), 'advanced', $sub ); ?>
135
+						<?php do_meta_boxes(get_current_screen(), 'normal', $sub); ?>
136
+						<?php do_meta_boxes(get_current_screen(), 'advanced', $sub); ?>
137 137
 					</div>
138 138
 
139 139
 				</div>
@@ -152,44 +152,44 @@  discard block
 block discarded – undo
152 152
  *
153 153
  * @param WPInv_Subscription $sub
154 154
  */
155
-function getpaid_admin_subscription_details_metabox( $sub ) {
155
+function getpaid_admin_subscription_details_metabox($sub) {
156 156
 
157 157
 	// Subscription items.
158
-	$subscription_group = getpaid_get_invoice_subscription_group( $sub->get_parent_invoice_id(), $sub->get_id() );
159
-	$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
158
+	$subscription_group = getpaid_get_invoice_subscription_group($sub->get_parent_invoice_id(), $sub->get_id());
159
+	$items_count        = empty($subscription_group) ? 1 : count($subscription_group['items']);
160 160
 
161 161
 	// Prepare subscription detail columns.
162 162
 	$fields = apply_filters(
163 163
 		'getpaid_subscription_admin_page_fields',
164 164
 		array(
165
-			'subscription'   => __( 'Subscription', 'invoicing' ),
166
-			'customer'       => __( 'Customer', 'invoicing' ),
167
-			'amount'         => __( 'Amount', 'invoicing' ),
168
-			'start_date'     => __( 'Start Date', 'invoicing' ),
169
-			'renews_on'      => __( 'Next Payment', 'invoicing' ),
170
-			'renewals'       => __( 'Payments', 'invoicing' ),
171
-			'item'           => _n( 'Item', 'Items', $items_count,  'invoicing' ),
172
-			'gateway'        => __( 'Payment Method', 'invoicing' ),
173
-			'profile_id'     => __( 'Profile ID', 'invoicing' ),
174
-			'status'         => __( 'Status', 'invoicing' ),
165
+			'subscription'   => __('Subscription', 'invoicing'),
166
+			'customer'       => __('Customer', 'invoicing'),
167
+			'amount'         => __('Amount', 'invoicing'),
168
+			'start_date'     => __('Start Date', 'invoicing'),
169
+			'renews_on'      => __('Next Payment', 'invoicing'),
170
+			'renewals'       => __('Payments', 'invoicing'),
171
+			'item'           => _n('Item', 'Items', $items_count, 'invoicing'),
172
+			'gateway'        => __('Payment Method', 'invoicing'),
173
+			'profile_id'     => __('Profile ID', 'invoicing'),
174
+			'status'         => __('Status', 'invoicing'),
175 175
 		)
176 176
 	);
177 177
 
178
-	if ( ! $sub->is_active() ) {
178
+	if (!$sub->is_active()) {
179 179
 
180
-		if ( isset( $fields['renews_on'] ) ) {
181
-			unset( $fields['renews_on'] );
180
+		if (isset($fields['renews_on'])) {
181
+			unset($fields['renews_on']);
182 182
 		}
183 183
 
184
-		if ( isset( $fields['gateway'] ) ) {
185
-			unset( $fields['gateway'] );
184
+		if (isset($fields['gateway'])) {
185
+			unset($fields['gateway']);
186 186
 		}
187 187
 
188 188
 	}
189 189
 
190 190
 	$profile_id = $sub->get_profile_id();
191
-	if ( empty( $profile_id ) && isset( $fields['profile_id'] ) ) {
192
-		unset( $fields['profile_id'] );
191
+	if (empty($profile_id) && isset($fields['profile_id'])) {
192
+		unset($fields['profile_id']);
193 193
 	}
194 194
 
195 195
 	?>
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 		<table class="table table-borderless" style="font-size: 14px;">
198 198
 			<tbody>
199 199
 
200
-				<?php foreach ( $fields as $key => $label ) : ?>
200
+				<?php foreach ($fields as $key => $label) : ?>
201 201
 
202
-					<tr class="getpaid-subscription-meta-<?php echo sanitize_html_class( $key ); ?>">
202
+					<tr class="getpaid-subscription-meta-<?php echo sanitize_html_class($key); ?>">
203 203
 
204 204
 						<th class="w-25" style="font-weight: 500;">
205
-							<?php echo sanitize_text_field( $label ); ?>
205
+							<?php echo sanitize_text_field($label); ?>
206 206
 						</th>
207 207
 
208 208
 						<td class="w-75 text-muted">
209
-							<?php do_action( 'getpaid_subscription_admin_display_' . sanitize_text_field( $key ), $sub, $subscription_group ); ?>
209
+							<?php do_action('getpaid_subscription_admin_display_' . sanitize_text_field($key), $sub, $subscription_group); ?>
210 210
 						</td>
211 211
 
212 212
 					</tr>
@@ -224,129 +224,129 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @param WPInv_Subscription $subscription
226 226
  */
227
-function getpaid_admin_subscription_metabox_display_customer( $subscription ) {
227
+function getpaid_admin_subscription_metabox_display_customer($subscription) {
228 228
 
229
-	$username = __( '(Missing User)', 'invoicing' );
229
+	$username = __('(Missing User)', 'invoicing');
230 230
 
231
-	$user = get_userdata( $subscription->get_customer_id() );
232
-	if ( $user ) {
231
+	$user = get_userdata($subscription->get_customer_id());
232
+	if ($user) {
233 233
 
234 234
 		$username = sprintf(
235 235
 			'<a href="user-edit.php?user_id=%s">%s</a>',
236
-			absint( $user->ID ),
237
-			! empty( $user->display_name ) ? sanitize_text_field( $user->display_name ) : sanitize_email( $user->user_email )
236
+			absint($user->ID),
237
+			!empty($user->display_name) ? sanitize_text_field($user->display_name) : sanitize_email($user->user_email)
238 238
 		);
239 239
 
240 240
 	}
241 241
 
242 242
 	echo  $username;
243 243
 }
244
-add_action( 'getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer' );
244
+add_action('getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer');
245 245
 
246 246
 /**
247 247
  * Displays the subscription amount.
248 248
  *
249 249
  * @param WPInv_Subscription $subscription
250 250
  */
251
-function getpaid_admin_subscription_metabox_display_amount( $subscription ) {
252
-	$amount    = sanitize_text_field( getpaid_get_formatted_subscription_amount( $subscription ) );
251
+function getpaid_admin_subscription_metabox_display_amount($subscription) {
252
+	$amount = sanitize_text_field(getpaid_get_formatted_subscription_amount($subscription));
253 253
 	echo "<span>$amount</span>";
254 254
 }
255
-add_action( 'getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount' );
255
+add_action('getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount');
256 256
 
257 257
 /**
258 258
  * Displays the subscription id.
259 259
  *
260 260
  * @param WPInv_Subscription $subscription
261 261
  */
262
-function getpaid_admin_subscription_metabox_display_id( $subscription ) {
263
-	echo  '#' . absint( $subscription->get_id() );
262
+function getpaid_admin_subscription_metabox_display_id($subscription) {
263
+	echo  '#' . absint($subscription->get_id());
264 264
 }
265
-add_action( 'getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id' );
265
+add_action('getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id');
266 266
 
267 267
 /**
268 268
  * Displays the subscription renewal date.
269 269
  *
270 270
  * @param WPInv_Subscription $subscription
271 271
  */
272
-function getpaid_admin_subscription_metabox_display_start_date( $subscription ) {
273
-	echo getpaid_format_date_value( $subscription->get_date_created() );
272
+function getpaid_admin_subscription_metabox_display_start_date($subscription) {
273
+	echo getpaid_format_date_value($subscription->get_date_created());
274 274
 }
275
-add_action( 'getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date' );
275
+add_action('getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date');
276 276
 
277 277
 /**
278 278
  * Displays the subscription renewal date.
279 279
  *
280 280
  * @param WPInv_Subscription $subscription
281 281
  */
282
-function getpaid_admin_subscription_metabox_display_renews_on( $subscription ) {
283
-	echo getpaid_format_date_value( $subscription->get_expiration() );
282
+function getpaid_admin_subscription_metabox_display_renews_on($subscription) {
283
+	echo getpaid_format_date_value($subscription->get_expiration());
284 284
 }
285
-add_action( 'getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on' );
285
+add_action('getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on');
286 286
 
287 287
 /**
288 288
  * Displays the subscription renewal count.
289 289
  *
290 290
  * @param WPInv_Subscription $subscription
291 291
  */
292
-function getpaid_admin_subscription_metabox_display_renewals( $subscription ) {
292
+function getpaid_admin_subscription_metabox_display_renewals($subscription) {
293 293
 	$max_bills = $subscription->get_bill_times();
294
-	echo $subscription->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "&infin;" : $max_bills );
294
+	echo $subscription->get_times_billed() . ' / ' . (empty($max_bills) ? "&infin;" : $max_bills);
295 295
 }
296
-add_action( 'getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals' );
296
+add_action('getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals');
297 297
 /**
298 298
  * Displays the subscription item.
299 299
  *
300 300
  * @param WPInv_Subscription $subscription
301 301
  * @param false|array $subscription_group
302 302
  */
303
-function getpaid_admin_subscription_metabox_display_item( $subscription, $subscription_group = false ) {
303
+function getpaid_admin_subscription_metabox_display_item($subscription, $subscription_group = false) {
304 304
 
305
-	if ( empty( $subscription_group ) ) {
306
-		echo WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() );
305
+	if (empty($subscription_group)) {
306
+		echo WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id());
307 307
 		return;
308 308
 	}
309 309
 
310
-	$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
311
-	echo implode( ' | ', $markup );
310
+	$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
311
+	echo implode(' | ', $markup);
312 312
 
313 313
 }
314
-add_action( 'getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2 );
314
+add_action('getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2);
315 315
 
316 316
 /**
317 317
  * Displays the subscription gateway.
318 318
  *
319 319
  * @param WPInv_Subscription $subscription
320 320
  */
321
-function getpaid_admin_subscription_metabox_display_gateway( $subscription ) {
321
+function getpaid_admin_subscription_metabox_display_gateway($subscription) {
322 322
 
323 323
 	$gateway = $subscription->get_gateway();
324 324
 
325
-	if ( ! empty( $gateway ) ) {
326
-		echo sanitize_text_field( wpinv_get_gateway_admin_label( $gateway ) );
325
+	if (!empty($gateway)) {
326
+		echo sanitize_text_field(wpinv_get_gateway_admin_label($gateway));
327 327
 	} else {
328 328
 		echo "&mdash;";
329 329
 	}
330 330
 
331 331
 }
332
-add_action( 'getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway' );
332
+add_action('getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway');
333 333
 
334 334
 /**
335 335
  * Displays the subscription status.
336 336
  *
337 337
  * @param WPInv_Subscription $subscription
338 338
  */
339
-function getpaid_admin_subscription_metabox_display_status( $subscription ) {
339
+function getpaid_admin_subscription_metabox_display_status($subscription) {
340 340
 	echo $subscription->get_status_label_html();
341 341
 }
342
-add_action( 'getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status' );
342
+add_action('getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status');
343 343
 
344 344
 /**
345 345
  * Displays the subscription profile id.
346 346
  *
347 347
  * @param WPInv_Subscription $subscription
348 348
  */
349
-function getpaid_admin_subscription_metabox_display_profile_id( $subscription ) {
349
+function getpaid_admin_subscription_metabox_display_profile_id($subscription) {
350 350
 
351 351
 	$profile_id = $subscription->get_profile_id();
352 352
 
@@ -355,32 +355,32 @@  discard block
 block discarded – undo
355 355
 			'type'        => 'text',
356 356
 			'id'          => 'wpinv_subscription_profile_id',
357 357
 			'name'        => 'wpinv_subscription_profile_id',
358
-			'label'       => __( 'Profile Id', 'invoicing' ),
358
+			'label'       => __('Profile Id', 'invoicing'),
359 359
 			'label_type'  => 'hidden',
360
-			'placeholder' => __( 'Profile Id', 'invoicing' ),
361
-			'value'       => sanitize_text_field( $profile_id ),
360
+			'placeholder' => __('Profile Id', 'invoicing'),
361
+			'value'       => sanitize_text_field($profile_id),
362 362
 			'input_group_right' => '',
363 363
 			'no_wrap'     => true,
364 364
 		)
365 365
 	);
366 366
 
367
-	echo str_ireplace( 'form-control', 'regular-text', $input );
367
+	echo str_ireplace('form-control', 'regular-text', $input);
368 368
 
369
-	$url = apply_filters( 'getpaid_remote_subscription_profile_url', '', $subscription );
370
-	if ( ! empty( $url ) ) {
371
-		$url = esc_url_raw( $url );
372
-		echo '&nbsp;<a href="' . $url . '" title="' . __( 'View in Gateway', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>';
369
+	$url = apply_filters('getpaid_remote_subscription_profile_url', '', $subscription);
370
+	if (!empty($url)) {
371
+		$url = esc_url_raw($url);
372
+		echo '&nbsp;<a href="' . $url . '" title="' . __('View in Gateway', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>';
373 373
 	}
374 374
 
375 375
 }
376
-add_action( 'getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id' );
376
+add_action('getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id');
377 377
 
378 378
 /**
379 379
  * Displays the subscriptions update metabox.
380 380
  *
381 381
  * @param WPInv_Subscription $subscription
382 382
  */
383
-function getpaid_admin_subscription_update_metabox( $subscription ) {
383
+function getpaid_admin_subscription_update_metabox($subscription) {
384 384
 
385 385
 	?>
386 386
 	<div class="mt-3">
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 					'id'               => 'subscription_status_update_select',
394 394
 					'required'         => true,
395 395
 					'no_wrap'          => false,
396
-					'label'            => __( 'Subscription Status', 'invoicing' ),
397
-					'help_text'        => __( 'Updating the status will trigger related actions and hooks', 'invoicing' ),
396
+					'label'            => __('Subscription Status', 'invoicing'),
397
+					'help_text'        => __('Updating the status will trigger related actions and hooks', 'invoicing'),
398 398
 					'select2'          => true,
399
-					'value'            => $subscription->get_status( 'edit' ),
399
+					'value'            => $subscription->get_status('edit'),
400 400
 				)
401 401
 			);
402 402
 		?>
@@ -404,13 +404,13 @@  discard block
 block discarded – undo
404 404
 		<div class="mt-2 px-3 py-2 bg-light border-top" style="margin: -12px;">
405 405
 
406 406
 		<?php
407
-			submit_button( __( 'Update', 'invoicing' ), 'primary', 'submit', false );
407
+			submit_button(__('Update', 'invoicing'), 'primary', 'submit', false);
408 408
 
409
-			$url    = esc_url( wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'subscription_manual_renew' ), 'getpaid-nonce', 'getpaid-nonce' ) );
410
-			$anchor = __( 'Renew Subscription', 'invoicing' );
411
-			$title  = esc_attr__( 'Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing' );
409
+			$url    = esc_url(wp_nonce_url(add_query_arg('getpaid-admin-action', 'subscription_manual_renew'), 'getpaid-nonce', 'getpaid-nonce'));
410
+			$anchor = __('Renew Subscription', 'invoicing');
411
+			$title  = esc_attr__('Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing');
412 412
 
413
-			if ( $subscription->is_active() ) {
413
+			if ($subscription->is_active()) {
414 414
 				echo "<a href='$url' class='float-right text-muted' onclick='return confirm(\"$title\")'>$anchor</a>";
415 415
 			}
416 416
 
@@ -422,31 +422,31 @@  discard block
 block discarded – undo
422 422
  *
423 423
  * @param WPInv_Subscription $subscription
424 424
  */
425
-function getpaid_admin_subscription_invoice_details_metabox( $subscription ) {
425
+function getpaid_admin_subscription_invoice_details_metabox($subscription) {
426 426
 
427 427
 	$columns = apply_filters(
428 428
 		'getpaid_subscription_related_invoices_columns',
429 429
 		array(
430
-			'invoice'      => __( 'Invoice', 'invoicing' ),
431
-			'relationship' => __( 'Relationship', 'invoicing' ),
432
-			'date'         => __( 'Date', 'invoicing' ),
433
-			'status'       => __( 'Status', 'invoicing' ),
434
-			'total'        => __( 'Total', 'invoicing' ),
430
+			'invoice'      => __('Invoice', 'invoicing'),
431
+			'relationship' => __('Relationship', 'invoicing'),
432
+			'date'         => __('Date', 'invoicing'),
433
+			'status'       => __('Status', 'invoicing'),
434
+			'total'        => __('Total', 'invoicing'),
435 435
 		),
436 436
 		$subscription
437 437
 	);
438 438
 
439 439
 	// Prepare the invoices.
440
-	$payments = $subscription->get_child_payments( ! is_admin() );
440
+	$payments = $subscription->get_child_payments(!is_admin());
441 441
 	$parent   = $subscription->get_parent_invoice();
442 442
 
443
-	if ( $parent->exists() ) {
444
-		$payments = array_merge( array( $parent ), $payments );
443
+	if ($parent->exists()) {
444
+		$payments = array_merge(array($parent), $payments);
445 445
 	}
446 446
 
447 447
 	$table_class = 'w-100 bg-white';
448 448
 
449
-	if ( ! is_admin() ) {
449
+	if (!is_admin()) {
450 450
 		$table_class = 'table table-bordered table-striped';
451 451
 	}
452 452
 
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 				<thead>
459 459
 					<tr>
460 460
 						<?php
461
-							foreach ( $columns as $key => $label ) {
462
-								$key   = esc_attr( $key );
463
-								$label = sanitize_text_field( $label );
461
+							foreach ($columns as $key => $label) {
462
+								$key   = esc_attr($key);
463
+								$label = sanitize_text_field($label);
464 464
 								$class = 'text-left';
465 465
 
466 466
 								echo "<th class='subscription-invoice-field-$key bg-light p-2 $class color-dark font-weight-bold'>$label</th>";
@@ -471,57 +471,57 @@  discard block
 block discarded – undo
471 471
 
472 472
 				<tbody>
473 473
 
474
-					<?php if ( empty( $payments ) ) : ?>
474
+					<?php if (empty($payments)) : ?>
475 475
 						<tr>
476 476
 							<td colspan="<?php echo count($columns); ?>" class="p-2 text-left text-muted">
477
-								<?php _e( 'This subscription has no invoices.', 'invoicing' ); ?>
477
+								<?php _e('This subscription has no invoices.', 'invoicing'); ?>
478 478
 							</td>
479 479
 						</tr>
480 480
 					<?php endif; ?>
481 481
 
482 482
 					<?php
483 483
 
484
-						foreach( $payments as $payment ) :
484
+						foreach ($payments as $payment) :
485 485
 
486 486
 							// Ensure that we have an invoice.
487
-							$payment = new WPInv_Invoice( $payment );
487
+							$payment = new WPInv_Invoice($payment);
488 488
 
489 489
 							// Abort if the invoice is invalid...
490
-							if ( ! $payment->exists() ) {
490
+							if (!$payment->exists()) {
491 491
 								continue;
492 492
 							}
493 493
 
494 494
 							// ... or belongs to a different subscription.
495
-							if ( $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id() ) {
495
+							if ($payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id()) {
496 496
 								continue;
497 497
 							}
498 498
 
499 499
 							echo '<tr>';
500 500
 
501
-								foreach ( array_keys( $columns ) as $key ) {
501
+								foreach (array_keys($columns) as $key) {
502 502
 
503 503
 									$class = 'text-left';
504 504
 
505 505
 									echo "<td class='p-2 $class'>";
506 506
 
507
-										switch( $key ) {
507
+										switch ($key) {
508 508
 
509 509
 											case 'total':
510
-												echo '<strong>' . wpinv_price( $payment->get_total(), $payment->get_currency() ) . '</strong>';
510
+												echo '<strong>' . wpinv_price($payment->get_total(), $payment->get_currency()) . '</strong>';
511 511
 												break;
512 512
 
513 513
 											case 'relationship':
514
-												echo $payment->is_renewal() ? __( 'Renewal Invoice', 'invoicing' ) : __( 'Initial Invoice', 'invoicing' );
514
+												echo $payment->is_renewal() ? __('Renewal Invoice', 'invoicing') : __('Initial Invoice', 'invoicing');
515 515
 												break;
516 516
 
517 517
 											case 'date':
518
-												echo getpaid_format_date_value( $payment->get_date_created() );
518
+												echo getpaid_format_date_value($payment->get_date_created());
519 519
 												break;
520 520
 
521 521
 											case 'status':
522 522
 
523 523
 												$status = $payment->get_status_nicename();
524
-												if ( is_admin() ) {
524
+												if (is_admin()) {
525 525
 													$status = $payment->get_status_label_html();
526 526
 												}
527 527
 
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 												break;
530 530
 
531 531
 											case 'invoice':
532
-												$link    = esc_url( get_edit_post_link( $payment->get_id() ) );
532
+												$link = esc_url(get_edit_post_link($payment->get_id()));
533 533
 
534
-												if ( ! is_admin() ) {
535
-													$link = esc_url( $payment->get_view_url() );
534
+												if (!is_admin()) {
535
+													$link = esc_url($payment->get_view_url());
536 536
 												}
537 537
 
538
-												$invoice = sanitize_text_field( $payment->get_number() );
538
+												$invoice = sanitize_text_field($payment->get_number());
539 539
 												echo "<a href='$link'>$invoice</a>";
540 540
 												break;
541 541
 										}
@@ -563,12 +563,12 @@  discard block
 block discarded – undo
563 563
  *
564 564
  * @param WPInv_Subscription $subscription
565 565
  */
566
-function getpaid_admin_subscription_item_details_metabox( $subscription ) {
566
+function getpaid_admin_subscription_item_details_metabox($subscription) {
567 567
 
568 568
 	// Fetch the subscription group.
569
-	$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_payment_id(), $subscription->get_id() );
569
+	$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_payment_id(), $subscription->get_id());
570 570
 
571
-	if ( empty( $subscription_group ) || empty( $subscription_group['items'] ) ) {
571
+	if (empty($subscription_group) || empty($subscription_group['items'])) {
572 572
 		return;
573 573
 	}
574 574
 
@@ -576,12 +576,12 @@  discard block
 block discarded – undo
576 576
 	$columns = apply_filters(
577 577
 		'getpaid_subscription_item_details_columns',
578 578
 		array(
579
-			'item_name'    => __( 'Item', 'invoicing' ),
580
-			'price'        => __( 'Price', 'invoicing' ),
581
-			'tax'          => __( 'Tax', 'invoicing' ),
582
-			'discount'     => __( 'Discount', 'invoicing' ),
583
-			'initial'      => __( 'Initial Amount', 'invoicing' ),
584
-			'recurring'    => __( 'Recurring Amount', 'invoicing' ),
579
+			'item_name'    => __('Item', 'invoicing'),
580
+			'price'        => __('Price', 'invoicing'),
581
+			'tax'          => __('Tax', 'invoicing'),
582
+			'discount'     => __('Discount', 'invoicing'),
583
+			'initial'      => __('Initial Amount', 'invoicing'),
584
+			'recurring'    => __('Recurring Amount', 'invoicing'),
585 585
 		),
586 586
 		$subscription
587 587
 	);
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
 
591 591
 	$invoice = $subscription->get_parent_invoice();
592 592
 
593
-	if ( ( ! wpinv_use_taxes() || ! $invoice->is_taxable() ) && isset( $columns['tax'] ) ) {
594
-		unset( $columns['tax'] );
593
+	if ((!wpinv_use_taxes() || !$invoice->is_taxable()) && isset($columns['tax'])) {
594
+		unset($columns['tax']);
595 595
 	}
596 596
 
597 597
 	$table_class = 'w-100 bg-white';
598 598
 
599
-	if ( ! is_admin() ) {
599
+	if (!is_admin()) {
600 600
 		$table_class = 'table table-bordered table-striped';
601 601
 	}
602 602
 
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
 					<tr>
610 610
 						<?php
611 611
 
612
-							foreach ( $columns as $key => $label ) {
613
-								$key   = esc_attr( $key );
614
-								$label = sanitize_text_field( $label );
612
+							foreach ($columns as $key => $label) {
613
+								$key   = esc_attr($key);
614
+								$label = sanitize_text_field($label);
615 615
 								$class = 'text-left';
616 616
 
617 617
 								echo "<th class='subscription-item-field-$key bg-light p-2 $class color-dark font-weight-bold'>$label</th>";
@@ -624,48 +624,48 @@  discard block
 block discarded – undo
624 624
 
625 625
 					<?php
626 626
 
627
-						foreach( $subscription_group['items'] as $subscription_group_item ) :
627
+						foreach ($subscription_group['items'] as $subscription_group_item) :
628 628
 
629 629
 							echo '<tr>';
630 630
 
631
-								foreach ( array_keys( $columns ) as $key ) {
631
+								foreach (array_keys($columns) as $key) {
632 632
 
633 633
 									$class = 'text-left';
634 634
 
635 635
 									echo "<td class='p-2 $class'>";
636 636
 
637
-										switch( $key ) {
637
+										switch ($key) {
638 638
 
639 639
 											case 'item_name':
640
-												$item_name = get_the_title( $subscription_group_item['item_id'] );
641
-												$item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name;
640
+												$item_name = get_the_title($subscription_group_item['item_id']);
641
+												$item_name = empty($item_name) ? $subscription_group_item['item_name'] : $item_name;
642 642
 
643
-												if ( $invoice->get_template() == 'amount' || 1 === (int) $subscription_group_item['quantity'] ) {
644
-													echo sanitize_text_field( $item_name );
643
+												if ($invoice->get_template() == 'amount' || 1 === (int) $subscription_group_item['quantity']) {
644
+													echo sanitize_text_field($item_name);
645 645
 												} else {
646
-													printf( '%1$s x %2$d', sanitize_text_field( $item_name ), (int) $subscription_group_item['quantity'] );
646
+													printf('%1$s x %2$d', sanitize_text_field($item_name), (int) $subscription_group_item['quantity']);
647 647
 												}
648 648
 
649 649
 												break;
650 650
 
651 651
 											case 'price':
652
-												echo wpinv_price( $subscription_group_item['price'], $invoice->get_currency() );
652
+												echo wpinv_price($subscription_group_item['price'], $invoice->get_currency());
653 653
 												break;
654 654
 
655 655
 											case 'tax':
656
-												echo wpinv_price( $subscription_group_item['tax'], $invoice->get_currency() );
656
+												echo wpinv_price($subscription_group_item['tax'], $invoice->get_currency());
657 657
 												break;
658 658
 
659 659
 											case 'discount':
660
-												echo wpinv_price( $subscription_group_item['discount'], $invoice->get_currency() );
660
+												echo wpinv_price($subscription_group_item['discount'], $invoice->get_currency());
661 661
 												break;
662 662
 
663 663
 											case 'initial':
664
-												echo wpinv_price( $subscription_group_item['subtotal'], $invoice->get_currency() );
664
+												echo wpinv_price($subscription_group_item['subtotal'], $invoice->get_currency());
665 665
 												break;
666 666
 
667 667
 											case 'recurring':
668
-												echo '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>';
668
+												echo '<strong>' . wpinv_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency()) . '</strong>';
669 669
 												break;
670 670
 
671 671
 										}
@@ -678,24 +678,24 @@  discard block
 block discarded – undo
678 678
 
679 679
 						endforeach;
680 680
 
681
-						foreach( $subscription_group['fees'] as $subscription_group_fee ) :
681
+						foreach ($subscription_group['fees'] as $subscription_group_fee) :
682 682
 
683 683
 							echo '<tr>';
684 684
 
685
-								foreach ( array_keys( $columns ) as $key ) {
685
+								foreach (array_keys($columns) as $key) {
686 686
 
687 687
 									$class = 'text-left';
688 688
 
689 689
 									echo "<td class='p-2 $class'>";
690 690
 
691
-										switch( $key ) {
691
+										switch ($key) {
692 692
 
693 693
 											case 'item_name':
694
-												echo sanitize_text_field( $subscription_group_fee['name'] );
694
+												echo sanitize_text_field($subscription_group_fee['name']);
695 695
 												break;
696 696
 
697 697
 											case 'price':
698
-												echo wpinv_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
698
+												echo wpinv_price($subscription_group_fee['initial_fee'], $invoice->get_currency());
699 699
 												break;
700 700
 
701 701
 											case 'tax':
@@ -707,11 +707,11 @@  discard block
 block discarded – undo
707 707
 												break;
708 708
 
709 709
 											case 'initial':
710
-												echo wpinv_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
710
+												echo wpinv_price($subscription_group_fee['initial_fee'], $invoice->get_currency());
711 711
 												break;
712 712
 
713 713
 											case 'recurring':
714
-												echo '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>';
714
+												echo '<strong>' . wpinv_price($subscription_group_fee['recurring_fee'], $invoice->get_currency()) . '</strong>';
715 715
 												break;
716 716
 
717 717
 										}
@@ -739,12 +739,12 @@  discard block
 block discarded – undo
739 739
  *
740 740
  * @param WPInv_Subscription $subscription
741 741
  */
742
-function getpaid_admin_subscription_related_subscriptions_metabox( $subscription ) {
742
+function getpaid_admin_subscription_related_subscriptions_metabox($subscription) {
743 743
 
744 744
 	// Fetch the subscription groups.
745
-	$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_payment_id() );
745
+	$subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_payment_id());
746 746
 
747
-	if ( empty( $subscription_groups ) ) {
747
+	if (empty($subscription_groups)) {
748 748
 		return;
749 749
 	}
750 750
 
@@ -752,19 +752,19 @@  discard block
 block discarded – undo
752 752
 	$columns = apply_filters(
753 753
 		'getpaid_subscription_related_subscriptions_columns',
754 754
 		array(
755
-			'subscription'      => __( 'Subscription', 'invoicing' ),
756
-			'start_date'        => __( 'Start Date', 'invoicing' ),
757
-			'renewal_date'      => __( 'Next Payment', 'invoicing' ),
758
-			'renewals'          => __( 'Payments', 'invoicing' ),
759
-			'item'              => __( 'Items', 'invoicing' ),
760
-			'status'            => __( 'Status', 'invoicing' ),
755
+			'subscription'      => __('Subscription', 'invoicing'),
756
+			'start_date'        => __('Start Date', 'invoicing'),
757
+			'renewal_date'      => __('Next Payment', 'invoicing'),
758
+			'renewals'          => __('Payments', 'invoicing'),
759
+			'item'              => __('Items', 'invoicing'),
760
+			'status'            => __('Status', 'invoicing'),
761 761
 		),
762 762
 		$subscription
763 763
 	);
764 764
 
765 765
 	$table_class = 'w-100 bg-white';
766 766
 
767
-	if ( ! is_admin() ) {
767
+	if (!is_admin()) {
768 768
 		$table_class = 'table table-bordered table-striped';
769 769
 	}
770 770
 
@@ -777,9 +777,9 @@  discard block
 block discarded – undo
777 777
 					<tr>
778 778
 						<?php
779 779
 
780
-							foreach ( $columns as $key => $label ) {
781
-								$key   = esc_attr( $key );
782
-								$label = sanitize_text_field( $label );
780
+							foreach ($columns as $key => $label) {
781
+								$key   = esc_attr($key);
782
+								$label = sanitize_text_field($label);
783 783
 								$class = 'text-left';
784 784
 
785 785
 								echo "<th class='related-subscription-field-$key bg-light p-2 $class color-dark font-weight-bold'>$label</th>";
@@ -792,62 +792,62 @@  discard block
 block discarded – undo
792 792
 
793 793
 					<?php
794 794
 
795
-						foreach( $subscription_groups as $subscription_group ) :
795
+						foreach ($subscription_groups as $subscription_group) :
796 796
 
797 797
 							// Do not list current subscription.
798
-							if ( (int) $subscription_group['subscription_id'] === $subscription->get_id() ) {
798
+							if ((int) $subscription_group['subscription_id'] === $subscription->get_id()) {
799 799
 								continue;
800 800
 							}
801 801
 
802 802
 							// Ensure the subscription exists.
803
-							$_suscription = new WPInv_Subscription( $subscription_group['subscription_id'] );
803
+							$_suscription = new WPInv_Subscription($subscription_group['subscription_id']);
804 804
 
805
-							if ( ! $_suscription->exists() ) {
805
+							if (!$_suscription->exists()) {
806 806
 								continue;
807 807
 							}
808 808
 
809 809
 							echo '<tr>';
810 810
 
811
-								foreach ( array_keys( $columns ) as $key ) {
811
+								foreach (array_keys($columns) as $key) {
812 812
 
813 813
 									$class = 'text-left';
814 814
 
815 815
 									echo "<td class='p-2 $class'>";
816 816
 
817
-										switch( $key ) {
817
+										switch ($key) {
818 818
 
819 819
 											case 'status':
820 820
 												echo $_suscription->get_status_label_html();
821 821
 												break;
822 822
 
823 823
 											case 'item':
824
-												$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
825
-												echo implode( ' | ', $markup );
824
+												$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
825
+												echo implode(' | ', $markup);
826 826
 												break;
827 827
 
828 828
 											case 'renewals':
829 829
 												$max_bills = $_suscription->get_bill_times();
830
-												echo $_suscription->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "&infin;" : $max_bills );
830
+												echo $_suscription->get_times_billed() . ' / ' . (empty($max_bills) ? "&infin;" : $max_bills);
831 831
 												break;
832 832
 
833 833
 											case 'renewal_date':
834
-												echo $_suscription->is_active() ? getpaid_format_date_value( $_suscription->get_expiration() ) : "&mdash;";
834
+												echo $_suscription->is_active() ? getpaid_format_date_value($_suscription->get_expiration()) : "&mdash;";
835 835
 												break;
836 836
 
837 837
 											case 'start_date':
838
-												echo getpaid_format_date_value( $_suscription->get_date_created() );
838
+												echo getpaid_format_date_value($_suscription->get_date_created());
839 839
 												break;
840 840
 
841 841
 											case 'subscription':
842
-												$url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url();
842
+												$url = is_admin() ? admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($_suscription->get_id())) : $_suscription->get_view_url();
843 843
 												printf(
844 844
 													'%1$s#%2$s%3$s',
845
-													'<a href="' . esc_url( $url ) . '">',
846
-													'<strong>' . intval( $_suscription->get_id() ) . '</strong>',
845
+													'<a href="' . esc_url($url) . '">',
846
+													'<strong>' . intval($_suscription->get_id()) . '</strong>',
847 847
 													'</a>'
848 848
 												);
849 849
 
850
-												echo WPInv_Subscriptions_List_Table::column_amount( $_suscription );
850
+												echo WPInv_Subscriptions_List_Table::column_amount($_suscription);
851 851
 												break;
852 852
 
853 853
 										}
Please login to merge, or discard this patch.