Passed
Push — master ( ed9391...1afebe )
by Brian
05:14
created
includes/admin/meta-boxes/class-getpaid-meta-box-item-vat.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Item_VAT {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the item.
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
     }
47 47
 
48 48
     /**
49
-	 * Output the VAT rules settings.
50
-	 *
51
-	 * @param WPInv_Item $item
52
-	 */
49
+     * Output the VAT rules settings.
50
+     *
51
+     * @param WPInv_Item $item
52
+     */
53 53
     public static function output_vat_rules( $item ) {
54 54
         ?>
55 55
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
     }
88 88
 
89 89
     /**
90
-	 * Output the VAT class settings.
91
-	 *
92
-	 * @param WPInv_Item $item
93
-	 */
90
+     * Output the VAT class settings.
91
+     *
92
+     * @param WPInv_Item $item
93
+     */
94 94
     public static function output_vat_classes( $item ) {
95 95
         ?>
96 96
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the item.
27
-        $item = new WPInv_Item( $post );
27
+        $item = new WPInv_Item($post);
28 28
 
29 29
         echo "<div class='bsui' style='max-width: 600px;padding-top: 10px;'>";
30 30
 
31
-        do_action( 'wpinv_item_before_vat_metabox', $item );
31
+        do_action('wpinv_item_before_vat_metabox', $item);
32 32
 
33 33
         // Output the vat rules settings.
34
-        do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item );
35
-        self::output_vat_rules( $item );
36
-        do_action( 'wpinv_item_vat_metabox_vat_rules', $item );
34
+        do_action('wpinv_item_vat_metabox_before_vat_rules', $item);
35
+        self::output_vat_rules($item);
36
+        do_action('wpinv_item_vat_metabox_vat_rules', $item);
37 37
 
38 38
         // Output vat class settings.
39
-        do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item );
40
-        self::output_vat_classes( $item );
41
-        do_action( 'wpinv_item_vat_metabox_vat_class', $item );
39
+        do_action('wpinv_item_vat_metabox_before_vat_rules', $item);
40
+        self::output_vat_classes($item);
41
+        do_action('wpinv_item_vat_metabox_vat_class', $item);
42 42
 
43
-        do_action( 'wpinv_item_vat_metabox', $item );
43
+        do_action('wpinv_item_vat_metabox', $item);
44 44
 
45 45
         echo '</div>';
46 46
     }
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param WPInv_Item $item
52 52
 	 */
53
-    public static function output_vat_rules( $item ) {
53
+    public static function output_vat_rules($item) {
54 54
         ?>
55 55
 
56 56
             <div class="wpinv_vat_rules">
57 57
 
58 58
                 <div class="form-group mb-3 row">
59 59
                     <label for="wpinv_vat_rules" class="col-sm-3 col-form-label">
60
-                        <?php esc_html_e( 'Tax Rule', 'invoicing' ); ?>
60
+                        <?php esc_html_e('Tax Rule', 'invoicing'); ?>
61 61
                     </label>
62 62
                     <div class="col-sm-8">
63 63
                         <?php
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
                                 array(
66 66
                                     'id'               => 'wpinv_vat_rules',
67 67
                                     'name'             => 'wpinv_vat_rules',
68
-                                    'placeholder'      => __( 'Select tax rule', 'invoicing' ),
69
-                                    'value'            => $item->get_vat_rule( 'edit' ),
68
+                                    'placeholder'      => __('Select tax rule', 'invoicing'),
69
+                                    'value'            => $item->get_vat_rule('edit'),
70 70
                                     'select2'          => true,
71 71
                                     'data-allow-clear' => 'false',
72 72
                                     'no_wrap'          => true,
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param WPInv_Item $item
91 91
 	 */
92
-    public static function output_vat_classes( $item ) {
92
+    public static function output_vat_classes($item) {
93 93
         ?>
94 94
 
95 95
             <div class="wpinv_vat_classes">
96 96
 
97 97
                 <div class="form-group mb-3 row">
98 98
                     <label for="wpinv_vat_class" class="col-sm-3 col-form-label">
99
-                        <?php esc_html_e( 'Tax Class', 'invoicing' ); ?>
99
+                        <?php esc_html_e('Tax Class', 'invoicing'); ?>
100 100
                     </label>
101 101
                     <div class="col-sm-8">
102 102
                         <?php
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
                                 array(
105 105
                                     'id'               => 'wpinv_vat_class',
106 106
                                     'name'             => 'wpinv_vat_class',
107
-                                    'placeholder'      => __( 'Select tax class', 'invoicing' ),
108
-                                    'value'            => $item->get_vat_class( 'edit' ),
107
+                                    'placeholder'      => __('Select tax class', 'invoicing'),
108
+                                    'value'            => $item->get_vat_class('edit'),
109 109
                                     'select2'          => true,
110 110
                                     'data-allow-clear' => 'false',
111 111
                                     'no_wrap'          => true,
Please login to merge, or discard this patch.
includes/class-wpinv-euvat.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,27 +55,27 @@
 block discarded – undo
55 55
     public static function vat_rates_settings() {}
56 56
 
57 57
     /**
58
-	 *
59
-	 * @deprecated
60
-	 */
58
+     *
59
+     * @deprecated
60
+     */
61 61
     public static function vat_settings() {}
62 62
 
63 63
     /**
64
-	 *
65
-	 * @deprecated
66
-	 */
64
+     *
65
+     * @deprecated
66
+     */
67 67
     public static function maxmind_folder() {}
68 68
 
69 69
     /**
70
-	 *
71
-	 * @deprecated
72
-	 */
70
+     *
71
+     * @deprecated
72
+     */
73 73
     public static function geoip2_download_database() {}
74 74
 
75 75
     /**
76
-	 *
77
-	 * @deprecated
78
-	 */
76
+     *
77
+     * @deprecated
78
+     */
79 79
     public static function geoip2_download_file() {}
80 80
 
81 81
     /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 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
 /**
10 10
  * @deprecated
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
     /**
39 39
      * @deprecated
40 40
      */
41
-    public static function is_eu_state( $country_code ) {
42
-        return getpaid_is_eu_state( $country_code );
41
+    public static function is_eu_state($country_code) {
42
+        return getpaid_is_eu_state($country_code);
43 43
     }
44 44
 
45 45
     /**
46 46
      * @deprecated
47 47
      */
48
-    public static function is_gst_country( $country_code ) {
49
-        return getpaid_is_gst_country( $country_code );
48
+    public static function is_gst_country($country_code) {
49
+        return getpaid_is_gst_country($country_code);
50 50
     }
51 51
 
52 52
     /**
Please login to merge, or discard this patch.
includes/data/eu-states.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version 1.0.19
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 return array(
12 12
 	'AT',
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,31 +9,31 @@
 block discarded – undo
9 9
 defined( 'ABSPATH' ) || exit;
10 10
 
11 11
 return array(
12
-	'AT',
13
-	'BE',
14
-	'BG',
15
-	'HR',
16
-	'CY',
17
-	'CZ',
18
-	'DK',
19
-	'EE',
20
-	'FI',
21
-	'FR',
22
-	'DE',
23
-	'GR',
24
-	'HU',
25
-	'IE',
26
-	'IT',
27
-	'LV',
28
-	'LT',
29
-	'LU',
30
-	'MT',
31
-	'NL',
32
-	'PL',
33
-	'PT',
34
-	'RO',
35
-	'SK',
36
-	'SI',
37
-	'ES',
38
-	'SE',
12
+    'AT',
13
+    'BE',
14
+    'BG',
15
+    'HR',
16
+    'CY',
17
+    'CZ',
18
+    'DK',
19
+    'EE',
20
+    'FI',
21
+    'FR',
22
+    'DE',
23
+    'GR',
24
+    'HU',
25
+    'IE',
26
+    'IT',
27
+    'LV',
28
+    'LT',
29
+    'LU',
30
+    'MT',
31
+    'NL',
32
+    'PL',
33
+    'PT',
34
+    'RO',
35
+    'SK',
36
+    'SI',
37
+    'ES',
38
+    'SE',
39 39
 );
Please login to merge, or discard this patch.
templates/invoice/details-top.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14
-        <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?>
14
+        <?php do_action('getpaid_before_invoice_details_top', $invoice); ?>
15 15
 
16 16
         <div class="getpaid-invoice-details-top mb-5">
17 17
             <div class="row">
18 18
                 <div class="col-12 col-sm-6 text-sm-left">
19
-                    <?php do_action( 'getpaid_invoice_details_top_left', $invoice ); ?>
19
+                    <?php do_action('getpaid_invoice_details_top_left', $invoice); ?>
20 20
                 </div>
21 21
 
22 22
                 <div class="col-12 col-sm-6 text-sm-right">
23
-                    <?php do_action( 'getpaid_invoice_details_top_right', $invoice ); ?>
23
+                    <?php do_action('getpaid_invoice_details_top_right', $invoice); ?>
24 24
                 </div>
25 25
             </div>
26 26
         </div>
27 27
 
28
-        <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?>
28
+        <?php do_action('getpaid_after_invoice_details_top', $invoice); ?>
29 29
 
30 30
 <?php
Please login to merge, or discard this patch.
templates/invoice/invoice.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         <?php
19 19
 
20 20
             // Fires when printing the header.
21
-            do_action( 'getpaid_invoice_header', $invoice );
21
+            do_action('getpaid_invoice_header', $invoice);
22 22
 
23 23
             // Print the opening wrapper.
24 24
             echo '<div class="container bg-white border mt-4 mb-4 p-4 position-relative flex-grow-1">';
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
             wpinv_print_errors();
28 28
 
29 29
             // Fires when printing the invoice details.
30
-            do_action( 'getpaid_invoice_details', $invoice );
30
+            do_action('getpaid_invoice_details', $invoice);
31 31
 
32 32
             // Fires when printing the invoice line items.
33
-            do_action( 'getpaid_invoice_line_items', $invoice );
33
+            do_action('getpaid_invoice_line_items', $invoice);
34 34
 
35 35
             // Print the closing wrapper.
36 36
             echo '</div>';
37 37
 
38 38
             // Fires when printing the invoice footer.
39
-            do_action( 'getpaid_invoice_footer', $invoice );
39
+            do_action('getpaid_invoice_footer', $invoice);
40 40
 
41 41
         ?>
42 42
 
Please login to merge, or discard this patch.
includes/api/class-getpaid-rest-report-top-earners-controller.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  * @since   2.0.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 /**
15 15
  * GetPaid REST top earners controller class.
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -18,50 +18,50 @@
 block discarded – undo
18 18
  */
19 19
 class GetPaid_REST_Report_Top_Earners_Controller extends GetPaid_REST_Report_Top_Sellers_Controller {
20 20
 
21
-	/**
22
-	 * Route base.
23
-	 *
24
-	 * @var string
25
-	 */
26
-	protected $rest_base = 'reports/top_earners';
21
+    /**
22
+     * Route base.
23
+     *
24
+     * @var string
25
+     */
26
+    protected $rest_base = 'reports/top_earners';
27 27
 
28
-	/**
29
-	 * Get all data needed for this report and store in the class.
30
-	 */
31
-	protected function query_report_data() {
28
+    /**
29
+     * Get all data needed for this report and store in the class.
30
+     */
31
+    protected function query_report_data() {
32 32
 
33
-		$this->report_data = GetPaid_Reports_Helper::get_invoice_report_data(
34
-			array(
35
-				'data'         => array(
36
-					'quantity'  => array(
37
-						'type'     => 'invoice_item',
38
-						'function' => 'SUM',
39
-						'name'     => 'invoice_item_qty',
40
-					),
41
-					'item_id'   => array(
42
-						'type'     => 'invoice_item',
43
-						'function' => '',
44
-						'name'     => 'invoice_item_id',
45
-					),
46
-					'item_name' => array(
47
-						'type'     => 'invoice_item',
48
-						'function' => '',
49
-						'name'     => 'invoice_item_name',
50
-					),
51
-					'price'     => array(
52
-						'type'     => 'invoice_item',
53
-						'function' => 'SUM',
54
-						'name'     => 'invoice_item_price',
55
-					),
56
-				),
57
-				'group_by'     => 'invoice_item_id',
58
-				'order_by'     => 'invoice_item_price DESC',
59
-				'query_type'   => 'get_results',
60
-				'limit'        => 10,
61
-				'filter_range' => $this->report_range,
62
-			)
63
-		);
33
+        $this->report_data = GetPaid_Reports_Helper::get_invoice_report_data(
34
+            array(
35
+                'data'         => array(
36
+                    'quantity'  => array(
37
+                        'type'     => 'invoice_item',
38
+                        'function' => 'SUM',
39
+                        'name'     => 'invoice_item_qty',
40
+                    ),
41
+                    'item_id'   => array(
42
+                        'type'     => 'invoice_item',
43
+                        'function' => '',
44
+                        'name'     => 'invoice_item_id',
45
+                    ),
46
+                    'item_name' => array(
47
+                        'type'     => 'invoice_item',
48
+                        'function' => '',
49
+                        'name'     => 'invoice_item_name',
50
+                    ),
51
+                    'price'     => array(
52
+                        'type'     => 'invoice_item',
53
+                        'function' => 'SUM',
54
+                        'name'     => 'invoice_item_price',
55
+                    ),
56
+                ),
57
+                'group_by'     => 'invoice_item_id',
58
+                'order_by'     => 'invoice_item_price DESC',
59
+                'query_type'   => 'get_results',
60
+                'limit'        => 10,
61
+                'filter_range' => $this->report_range,
62
+            )
63
+        );
64 64
 
65
-	}
65
+    }
66 66
 
67 67
 }
Please login to merge, or discard this patch.
includes/class-wpinv-api.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since    1.0.19
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * The main API class
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->invoice_counts = new GetPaid_REST_Report_Invoice_Counts_Controller();
97 97
 
98 98
         // Fires after loading the rest api.
99
-        do_action( 'getpaid_rest_api_loaded', $this );
99
+        do_action('getpaid_rest_api_loaded', $this);
100 100
     }
101 101
 
102 102
 }
Please login to merge, or discard this patch.
includes/api/class-getpaid-rest-report-invoice-counts-controller.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -18,102 +18,102 @@
 block discarded – undo
18 18
  */
19 19
 class GetPaid_REST_Report_Invoice_Counts_Controller extends GetPaid_REST_Reports_Controller {
20 20
 
21
-	/**
22
-	 * Route base.
23
-	 *
24
-	 * @var string
25
-	 */
26
-	protected $rest_base = 'reports/invoices/counts';
27
-
28
-	/**
29
-	 * Prepare a report object for serialization.
30
-	 *
31
-	 * @param  stdClass        $report Report data.
32
-	 * @param  WP_REST_Request $request Request object.
33
-	 * @return WP_REST_Response $response Response data.
34
-	 */
35
-	public function prepare_item_for_response( $report, $request ) {
36
-
37
-		$data    = (array) $report;
38
-		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
39
-		$data    = $this->add_additional_fields_to_object( $data, $request );
40
-		$data    = $this->filter_response_by_context( $data, $context );
41
-
42
-		// Wrap the data in a response object.
43
-		$response = rest_ensure_response( $data );
44
-
45
-		$response->add_links(
46
-			array(
47
-				'about' => array(
48
-					'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ),
49
-				),
50
-			)
51
-		);
52
-
53
-		return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request );
54
-	}
55
-
56
-	/**
57
-	 * Get reports list.
58
-	 *
59
-	 * @since 2.0.0
60
-	 * @return array
61
-	 */
62
-	protected function get_reports() {
63
-
64
-		$counts = wp_count_posts( 'wpi_invoice' );
65
-		$data   = array();
66
-
67
-		foreach ( wpinv_get_invoice_statuses() as $slug => $name ) {
68
-
69
-			if ( ! isset( $counts->$slug ) ) {
70
-				continue;
71
-			}
72
-
73
-			$data[] = array(
74
-				'slug'  => $slug,
75
-				'name'  => $name,
76
-				'count' => (int) $counts->$slug,
77
-			);
78
-
79
-		}
80
-
81
-		return $data;
82
-
83
-	}
84
-
85
-	/**
86
-	 * Get the Report's schema, conforming to JSON Schema.
87
-	 *
88
-	 * @return array
89
-	 */
90
-	public function get_item_schema() {
91
-		$schema = array(
92
-			'$schema'    => 'http://json-schema.org/draft-04/schema#',
93
-			'title'      => 'report_invoice_counts',
94
-			'type'       => 'object',
95
-			'properties' => array(
96
-				'slug'  => array(
97
-					'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ),
98
-					'type'        => 'string',
99
-					'context'     => array( 'view' ),
100
-					'readonly'    => true,
101
-				),
102
-				'name'  => array(
103
-					'description' => __( 'Invoice status name.', 'invoicing' ),
104
-					'type'        => 'string',
105
-					'context'     => array( 'view' ),
106
-					'readonly'    => true,
107
-				),
108
-				'count' => array(
109
-					'description' => __( 'Number of invoices.', 'invoicing' ),
110
-					'type'        => 'string',
111
-					'context'     => array( 'view' ),
112
-					'readonly'    => true,
113
-				),
114
-			),
115
-		);
116
-
117
-		return $this->add_additional_fields_schema( $schema );
118
-	}
21
+    /**
22
+     * Route base.
23
+     *
24
+     * @var string
25
+     */
26
+    protected $rest_base = 'reports/invoices/counts';
27
+
28
+    /**
29
+     * Prepare a report object for serialization.
30
+     *
31
+     * @param  stdClass        $report Report data.
32
+     * @param  WP_REST_Request $request Request object.
33
+     * @return WP_REST_Response $response Response data.
34
+     */
35
+    public function prepare_item_for_response( $report, $request ) {
36
+
37
+        $data    = (array) $report;
38
+        $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
39
+        $data    = $this->add_additional_fields_to_object( $data, $request );
40
+        $data    = $this->filter_response_by_context( $data, $context );
41
+
42
+        // Wrap the data in a response object.
43
+        $response = rest_ensure_response( $data );
44
+
45
+        $response->add_links(
46
+            array(
47
+                'about' => array(
48
+                    'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ),
49
+                ),
50
+            )
51
+        );
52
+
53
+        return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request );
54
+    }
55
+
56
+    /**
57
+     * Get reports list.
58
+     *
59
+     * @since 2.0.0
60
+     * @return array
61
+     */
62
+    protected function get_reports() {
63
+
64
+        $counts = wp_count_posts( 'wpi_invoice' );
65
+        $data   = array();
66
+
67
+        foreach ( wpinv_get_invoice_statuses() as $slug => $name ) {
68
+
69
+            if ( ! isset( $counts->$slug ) ) {
70
+                continue;
71
+            }
72
+
73
+            $data[] = array(
74
+                'slug'  => $slug,
75
+                'name'  => $name,
76
+                'count' => (int) $counts->$slug,
77
+            );
78
+
79
+        }
80
+
81
+        return $data;
82
+
83
+    }
84
+
85
+    /**
86
+     * Get the Report's schema, conforming to JSON Schema.
87
+     *
88
+     * @return array
89
+     */
90
+    public function get_item_schema() {
91
+        $schema = array(
92
+            '$schema'    => 'http://json-schema.org/draft-04/schema#',
93
+            'title'      => 'report_invoice_counts',
94
+            'type'       => 'object',
95
+            'properties' => array(
96
+                'slug'  => array(
97
+                    'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ),
98
+                    'type'        => 'string',
99
+                    'context'     => array( 'view' ),
100
+                    'readonly'    => true,
101
+                ),
102
+                'name'  => array(
103
+                    'description' => __( 'Invoice status name.', 'invoicing' ),
104
+                    'type'        => 'string',
105
+                    'context'     => array( 'view' ),
106
+                    'readonly'    => true,
107
+                ),
108
+                'count' => array(
109
+                    'description' => __( 'Number of invoices.', 'invoicing' ),
110
+                    'type'        => 'string',
111
+                    'context'     => array( 'view' ),
112
+                    'readonly'    => true,
113
+                ),
114
+            ),
115
+        );
116
+
117
+        return $this->add_additional_fields_schema( $schema );
118
+    }
119 119
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since   2.0.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 /**
15 15
  * GetPaid REST invoice counts controller class.
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 	 * @param  WP_REST_Request $request Request object.
33 33
 	 * @return WP_REST_Response $response Response data.
34 34
 	 */
35
-	public function prepare_item_for_response( $report, $request ) {
35
+	public function prepare_item_for_response($report, $request) {
36 36
 
37 37
 		$data    = (array) $report;
38
-		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
39
-		$data    = $this->add_additional_fields_to_object( $data, $request );
40
-		$data    = $this->filter_response_by_context( $data, $context );
38
+		$context = !empty($request['context']) ? $request['context'] : 'view';
39
+		$data    = $this->add_additional_fields_to_object($data, $request);
40
+		$data    = $this->filter_response_by_context($data, $context);
41 41
 
42 42
 		// Wrap the data in a response object.
43
-		$response = rest_ensure_response( $data );
43
+		$response = rest_ensure_response($data);
44 44
 
45 45
 		$response->add_links(
46 46
 			array(
47 47
 				'about' => array(
48
-					'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ),
48
+					'href' => rest_url(sprintf('%s/reports', $this->namespace)),
49 49
 				),
50 50
 			)
51 51
 		);
52 52
 
53
-		return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request );
53
+		return apply_filters('getpaid_rest_prepare_report_invoices_count', $response, $report, $request);
54 54
 	}
55 55
 
56 56
 	/**
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	protected function get_reports() {
63 63
 
64
-		$counts = wp_count_posts( 'wpi_invoice' );
64
+		$counts = wp_count_posts('wpi_invoice');
65 65
 		$data   = array();
66 66
 
67
-		foreach ( wpinv_get_invoice_statuses() as $slug => $name ) {
67
+		foreach (wpinv_get_invoice_statuses() as $slug => $name) {
68 68
 
69
-			if ( ! isset( $counts->$slug ) ) {
69
+			if (!isset($counts->$slug)) {
70 70
 				continue;
71 71
 			}
72 72
 
@@ -94,26 +94,26 @@  discard block
 block discarded – undo
94 94
 			'type'       => 'object',
95 95
 			'properties' => array(
96 96
 				'slug'  => array(
97
-					'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ),
97
+					'description' => __('An alphanumeric identifier for the resource.', 'invoicing'),
98 98
 					'type'        => 'string',
99
-					'context'     => array( 'view' ),
99
+					'context'     => array('view'),
100 100
 					'readonly'    => true,
101 101
 				),
102 102
 				'name'  => array(
103
-					'description' => __( 'Invoice status name.', 'invoicing' ),
103
+					'description' => __('Invoice status name.', 'invoicing'),
104 104
 					'type'        => 'string',
105
-					'context'     => array( 'view' ),
105
+					'context'     => array('view'),
106 106
 					'readonly'    => true,
107 107
 				),
108 108
 				'count' => array(
109
-					'description' => __( 'Number of invoices.', 'invoicing' ),
109
+					'description' => __('Number of invoices.', 'invoicing'),
110 110
 					'type'        => 'string',
111
-					'context'     => array( 'view' ),
111
+					'context'     => array('view'),
112 112
 					'readonly'    => true,
113 113
 				),
114 114
 			),
115 115
 		);
116 116
 
117
-		return $this->add_additional_fields_schema( $schema );
117
+		return $this->add_additional_fields_schema($schema);
118 118
 	}
119 119
 }
Please login to merge, or discard this patch.
includes/data/vat-number-regexes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @package Invoicing/data
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 return array(
12 12
 
Please login to merge, or discard this patch.