Completed
Pull Request — master (#1383)
by
unknown
01:48
created
includes/admin/class-wc-stripe-inbox-notes.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -21,6 +21,7 @@
 block discarded – undo
21 21
 
22 22
 	/**
23 23
 	 * Manage notes to show after Apple Pay domain verification.
24
+	 * @param boolean $verification_complete
24 25
 	 */
25 26
 	public static function notify_on_apple_pay_domain_verification( $verification_complete ) {
26 27
 		if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) {
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -18,41 +18,41 @@  discard block
 block discarded – undo
18 18
 	const POST_SETUP_SUCCESS_ACTION = 'wc_stripe_apple_pay_post_setup_success';
19 19
 
20 20
 	public function __construct() {
21
-		add_action( self::POST_SETUP_SUCCESS_ACTION, array( self::class, 'create_marketing_note' ) );
21
+		add_action(self::POST_SETUP_SUCCESS_ACTION, array(self::class, 'create_marketing_note'));
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * Manage notes to show after Apple Pay domain verification.
26 26
 	 */
27
-	public static function notify_on_apple_pay_domain_verification( $verification_complete ) {
28
-		if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) {
27
+	public static function notify_on_apple_pay_domain_verification($verification_complete) {
28
+		if ( ! class_exists('Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes')) {
29 29
 			return;
30 30
 		}
31 31
 
32
-		if ( ! class_exists( 'WC_Data_Store' ) ) {
32
+		if ( ! class_exists('WC_Data_Store')) {
33 33
 			return;
34 34
 		}
35 35
 
36
-		if ( $verification_complete ) {
37
-			if ( self::should_show_marketing_note() && ! wp_next_scheduled( self::POST_SETUP_SUCCESS_ACTION ) ) {
38
-				wp_schedule_single_event( time() + DAY_IN_SECONDS, self::POST_SETUP_SUCCESS_ACTION );
36
+		if ($verification_complete) {
37
+			if (self::should_show_marketing_note() && ! wp_next_scheduled(self::POST_SETUP_SUCCESS_ACTION)) {
38
+				wp_schedule_single_event(time() + DAY_IN_SECONDS, self::POST_SETUP_SUCCESS_ACTION);
39 39
 			}
40 40
 
41 41
 			// If the domain verification completed after failure note was created, make sure it's marked as actioned.
42 42
 			try {
43
-				$data_store       = WC_Data_Store::load( 'admin-note' );
44
-				$failure_note_ids = $data_store->get_notes_with_name( self::FAILURE_NOTE_NAME );
45
-				if ( ! empty( $failure_note_ids ) ) {
46
-					$note_id = array_pop( $failure_note_ids );
47
-					$note    = WC_Admin_Notes::get_note( $note_id );
48
-					if ( false !== $note && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) {
49
-						$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED );
43
+				$data_store       = WC_Data_Store::load('admin-note');
44
+				$failure_note_ids = $data_store->get_notes_with_name(self::FAILURE_NOTE_NAME);
45
+				if ( ! empty($failure_note_ids)) {
46
+					$note_id = array_pop($failure_note_ids);
47
+					$note    = WC_Admin_Notes::get_note($note_id);
48
+					if (false !== $note && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status()) {
49
+						$note->set_status(WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED);
50 50
 						$note->save();
51 51
 					}
52 52
 				}
53
-			} catch ( Exception $e ) {}  // @codingStandardsIgnoreLine.
53
+			} catch (Exception $e) {}  // @codingStandardsIgnoreLine.
54 54
 		} else {
55
-			if ( empty( $failure_note_ids ) ) {
55
+			if (empty($failure_note_ids)) {
56 56
 				self::create_failure_note();
57 57
 			}
58 58
 		}
@@ -64,27 +64,27 @@  discard block
 block discarded – undo
64 64
 	public static function should_show_marketing_note() {
65 65
 		// Display to US merchants only.
66 66
 		$base_location = wc_get_base_location();
67
-		if ( ! $base_location || 'US' !== $base_location['country'] ) {
67
+		if ( ! $base_location || 'US' !== $base_location['country']) {
68 68
 			return false;
69 69
 		}
70 70
 
71 71
 		// Make sure Apple Pay is enabled and setup is successful.
72
-		$stripe_settings       = get_option( 'woocommerce_stripe_settings', array() );
73
-		$stripe_enabled        = isset( $stripe_settings['enabled'] ) && 'yes' === $stripe_settings['enabled'];
74
-		$button_enabled        = isset( $stripe_settings['payment_request'] ) && 'yes' === $stripe_settings['payment_request'];
75
-		$verification_complete = isset( $stripe_settings['apple_pay_domain_set'] ) && 'yes' === $stripe_settings['apple_pay_domain_set'];
76
-		if ( ! $stripe_enabled || ! $button_enabled || ! $verification_complete ) {
72
+		$stripe_settings       = get_option('woocommerce_stripe_settings', array());
73
+		$stripe_enabled        = isset($stripe_settings['enabled']) && 'yes' === $stripe_settings['enabled'];
74
+		$button_enabled        = isset($stripe_settings['payment_request']) && 'yes' === $stripe_settings['payment_request'];
75
+		$verification_complete = isset($stripe_settings['apple_pay_domain_set']) && 'yes' === $stripe_settings['apple_pay_domain_set'];
76
+		if ( ! $stripe_enabled || ! $button_enabled || ! $verification_complete) {
77 77
 			return false;
78 78
 		}
79 79
 
80 80
 		// Make sure note doesn't already exist.
81 81
 		try {
82
-			$data_store       = WC_Data_Store::load( 'admin-note' );
83
-			$success_note_ids = $data_store->get_notes_with_name( self::SUCCESS_NOTE_NAME );
84
-			if ( ! empty( $success_note_ids ) ) {
82
+			$data_store       = WC_Data_Store::load('admin-note');
83
+			$success_note_ids = $data_store->get_notes_with_name(self::SUCCESS_NOTE_NAME);
84
+			if ( ! empty($success_note_ids)) {
85 85
 				return false;
86 86
 			}
87
-		} catch ( Exception $e ) {
87
+		} catch (Exception $e) {
88 88
 			return false; // If unable to check, assume it shouldn't show note.
89 89
 		}
90 90
 
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function create_marketing_note() {
98 98
 		// Make sure conditions for this note still hold.
99
-		if ( ! self::should_show_marketing_note() ) {
99
+		if ( ! self::should_show_marketing_note()) {
100 100
 			return;
101 101
 		}
102 102
 
103 103
 		$note = new WC_Admin_Note();
104
-		$note->set_title( __( 'Boost sales this holiday season with Apple Pay!', 'woocommerce-gateway-stripe' ) );
105
-		$note->set_content( __( 'Now that you accept Apple Pay® with Stripe, you can increase conversion rates by letting your customers know that Apple Pay is available. Here’s a marketing guide to help you get started.', 'woocommerce-gateway-stripe' ) );
106
-		$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING );
107
-		$note->set_name( self::SUCCESS_NOTE_NAME );
108
-		$note->set_source( 'woocommerce-gateway-stripe' );
104
+		$note->set_title(__('Boost sales this holiday season with Apple Pay!', 'woocommerce-gateway-stripe'));
105
+		$note->set_content(__('Now that you accept Apple Pay® with Stripe, you can increase conversion rates by letting your customers know that Apple Pay is available. Here’s a marketing guide to help you get started.', 'woocommerce-gateway-stripe'));
106
+		$note->set_type(WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING);
107
+		$note->set_name(self::SUCCESS_NOTE_NAME);
108
+		$note->set_source('woocommerce-gateway-stripe');
109 109
 		$note->add_action(
110 110
 			'marketing-guide',
111
-			__( 'See marketing guide', 'woocommerce-gateway-stripe' ),
111
+			__('See marketing guide', 'woocommerce-gateway-stripe'),
112 112
 			'https://developer.apple.com/apple-pay/marketing/'
113 113
 		);
114 114
 		$note->save();
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public static function create_failure_note() {
121 121
 		$note = new WC_Admin_Note();
122
-		$note->set_title( __( 'Apple Pay domain verification needed', 'woocommerce-gateway-stripe' ) );
123
-		$note->set_content( __( 'The WooCommerce Stripe Gateway extension attempted to perform domain verification on behalf of your store, but was unable to do so. This must be resolved before Apple Pay can be offered to your customers.', 'woocommerce-gateway-stripe' ) );
124
-		$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
125
-		$note->set_name( self::FAILURE_NOTE_NAME );
126
-		$note->set_source( 'woocommerce-gateway-stripe' );
122
+		$note->set_title(__('Apple Pay domain verification needed', 'woocommerce-gateway-stripe'));
123
+		$note->set_content(__('The WooCommerce Stripe Gateway extension attempted to perform domain verification on behalf of your store, but was unable to do so. This must be resolved before Apple Pay can be offered to your customers.', 'woocommerce-gateway-stripe'));
124
+		$note->set_type(WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL);
125
+		$note->set_name(self::FAILURE_NOTE_NAME);
126
+		$note->set_source('woocommerce-gateway-stripe');
127 127
 		$note->add_action(
128 128
 			'learn-more',
129
-			__( 'Learn more', 'woocommerce-gateway-stripe' ),
129
+			__('Learn more', 'woocommerce-gateway-stripe'),
130 130
 			'https://docs.woocommerce.com/document/stripe/#apple-pay'
131 131
 		);
132 132
 		$note->save();
Please login to merge, or discard this patch.
woocommerce-gateway-stripe.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -15,20 +15,20 @@  discard block
 block discarded – undo
15 15
  *
16 16
  */
17 17
 
18
-if ( ! defined( 'ABSPATH' ) ) {
18
+if ( ! defined('ABSPATH')) {
19 19
 	exit;
20 20
 }
21 21
 
22 22
 /**
23 23
  * Required minimums and constants
24 24
  */
25
-define( 'WC_STRIPE_VERSION', '4.5.5' ); // WRCS: DEFINED_VERSION.
26
-define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
27
-define( 'WC_STRIPE_MIN_WC_VER', '3.9' );
28
-define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.9' );
29
-define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
30
-define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
31
-define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
25
+define('WC_STRIPE_VERSION', '4.5.5'); // WRCS: DEFINED_VERSION.
26
+define('WC_STRIPE_MIN_PHP_VER', '5.6.0');
27
+define('WC_STRIPE_MIN_WC_VER', '3.9');
28
+define('WC_STRIPE_FUTURE_MIN_WC_VER', '3.9');
29
+define('WC_STRIPE_MAIN_FILE', __FILE__);
30
+define('WC_STRIPE_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
31
+define('WC_STRIPE_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__)));
32 32
 
33 33
 // phpcs:disable WordPress.Files.FileName
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function woocommerce_stripe_missing_wc_notice() {
42 42
 	/* translators: 1. URL link. */
43
-	echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'Stripe requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-gateway-stripe' ), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>' ) . '</strong></p></div>';
43
+	echo '<div class="error"><p><strong>' . sprintf(esc_html__('Stripe requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-gateway-stripe'), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>') . '</strong></p></div>';
44 44
 }
45 45
 
46 46
 /**
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function woocommerce_stripe_wc_not_supported() {
53 53
 	/* translators: $1. Minimum WooCommerce version. $2. Current WooCommerce version. */
54
-	echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'Stripe requires WooCommerce %1$s or greater to be installed and active. WooCommerce %2$s is no longer supported.', 'woocommerce-gateway-stripe' ), WC_STRIPE_MIN_WC_VER, WC_VERSION ) . '</strong></p></div>';
54
+	echo '<div class="error"><p><strong>' . sprintf(esc_html__('Stripe requires WooCommerce %1$s or greater to be installed and active. WooCommerce %2$s is no longer supported.', 'woocommerce-gateway-stripe'), WC_STRIPE_MIN_WC_VER, WC_VERSION) . '</strong></p></div>';
55 55
 }
56 56
 
57 57
 function wc_stripe() {
58 58
 
59 59
 	static $plugin;
60 60
 
61
-	if ( ! isset( $plugin ) ) {
61
+	if ( ! isset($plugin)) {
62 62
 
63 63
 		class WC_Stripe {
64 64
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			 * @return Singleton The *Singleton* instance.
74 74
 			 */
75 75
 			public static function get_instance() {
76
-				if ( null === self::$instance ) {
76
+				if (null === self::$instance) {
77 77
 					self::$instance = new self();
78 78
 				}
79 79
 				return self::$instance;
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 			 * *Singleton* via the `new` operator from outside of this class.
115 115
 			 */
116 116
 			public function __construct() {
117
-				add_action( 'admin_init', array( $this, 'install' ) );
117
+				add_action('admin_init', array($this, 'install'));
118 118
 
119 119
 				$this->init();
120 120
 
121 121
 				$this->api     = new WC_Stripe_Connect_API();
122
-				$this->connect = new WC_Stripe_Connect( $this->api );
122
+				$this->connect = new WC_Stripe_Connect($this->api);
123 123
 
124
-				add_action( 'rest_api_init', array( $this, 'register_connect_routes' ) );
124
+				add_action('rest_api_init', array($this, 'register_connect_routes'));
125 125
 			}
126 126
 
127 127
 			/**
@@ -131,57 +131,57 @@  discard block
 block discarded – undo
131 131
 			 * @version 4.0.0
132 132
 			 */
133 133
 			public function init() {
134
-				if ( is_admin() ) {
135
-					require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php';
134
+				if (is_admin()) {
135
+					require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php';
136 136
 				}
137 137
 
138
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php';
139
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php';
140
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php';
141
-				include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php';
142
-				require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php';
143
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php';
144
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php';
145
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php';
146
-				require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php';
147
-				require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php';
148
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php';
149
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php';
150
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php';
151
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php';
152
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php';
153
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php';
154
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php';
155
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php';
156
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php';
157
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php';
158
-				require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php';
159
-				require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php';
160
-				require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php';
161
-				require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php';
162
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php';
163
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php';
164
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php';
165
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php';
166
-				require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-inbox-notes.php';
167
-
168
-				if ( is_admin() ) {
169
-					require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php';
138
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php';
139
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php';
140
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php';
141
+				include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php';
142
+				require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php';
143
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php';
144
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php';
145
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php';
146
+				require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php';
147
+				require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php';
148
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php';
149
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php';
150
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php';
151
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php';
152
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php';
153
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php';
154
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php';
155
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php';
156
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php';
157
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php';
158
+				require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php';
159
+				require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php';
160
+				require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect.php';
161
+				require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect-api.php';
162
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php';
163
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php';
164
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php';
165
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.php';
166
+				require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-inbox-notes.php';
167
+
168
+				if (is_admin()) {
169
+					require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php';
170 170
 				}
171 171
 
172 172
 				// REMOVE IN THE FUTURE.
173
-				require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php';
173
+				require_once dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php';
174 174
 
175
-				add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
176
-				add_filter( 'pre_update_option_woocommerce_stripe_settings', array( $this, 'gateway_settings_update' ), 10, 2 );
177
-				add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
178
-				add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
175
+				add_filter('woocommerce_payment_gateways', array($this, 'add_gateways'));
176
+				add_filter('pre_update_option_woocommerce_stripe_settings', array($this, 'gateway_settings_update'), 10, 2);
177
+				add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links'));
178
+				add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
179 179
 
180 180
 				// Modify emails emails.
181
-				add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 );
181
+				add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20);
182 182
 
183
-				if ( version_compare( WC_VERSION, '3.4', '<' ) ) {
184
-					add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) );
183
+				if (version_compare(WC_VERSION, '3.4', '<')) {
184
+					add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin'));
185 185
 				}
186 186
 			}
187 187
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 			 * @version 4.0.0
193 193
 			 */
194 194
 			public function update_plugin_version() {
195
-				delete_option( 'wc_stripe_version' );
196
-				update_option( 'wc_stripe_version', WC_STRIPE_VERSION );
195
+				delete_option('wc_stripe_version');
196
+				update_option('wc_stripe_version', WC_STRIPE_VERSION);
197 197
 			}
198 198
 
199 199
 			/**
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
 			 * @version 3.1.0
204 204
 			 */
205 205
 			public function install() {
206
-				if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) {
206
+				if ( ! is_plugin_active(plugin_basename(__FILE__))) {
207 207
 					return;
208 208
 				}
209 209
 
210
-				if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) {
211
-					do_action( 'woocommerce_stripe_updated' );
210
+				if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) {
211
+					do_action('woocommerce_stripe_updated');
212 212
 
213
-					if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) {
214
-						define( 'WC_STRIPE_INSTALLING', true );
213
+					if ( ! defined('WC_STRIPE_INSTALLING')) {
214
+						define('WC_STRIPE_INSTALLING', true);
215 215
 					}
216 216
 
217 217
 					$this->update_plugin_version();
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 			 * @since 1.0.0
225 225
 			 * @version 4.0.0
226 226
 			 */
227
-			public function plugin_action_links( $links ) {
227
+			public function plugin_action_links($links) {
228 228
 				$plugin_links = array(
229
-					'<a href="admin.php?page=wc-settings&tab=checkout&section=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>',
229
+					'<a href="admin.php?page=wc-settings&tab=checkout&section=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>',
230 230
 				);
231
-				return array_merge( $plugin_links, $links );
231
+				return array_merge($plugin_links, $links);
232 232
 			}
233 233
 
234 234
 			/**
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 			 * @param  string $file  Name of current file.
240 240
 			 * @return array  $links Update list of plugin links.
241 241
 			 */
242
-			public function plugin_row_meta( $links, $file ) {
243
-				if ( plugin_basename( __FILE__ ) === $file ) {
242
+			public function plugin_row_meta($links, $file) {
243
+				if (plugin_basename(__FILE__) === $file) {
244 244
 					$row_meta = array(
245
-						'docs'    => '<a href="' . esc_url( apply_filters( 'woocommerce_gateway_stripe_docs_url', 'https://docs.woocommerce.com/document/stripe/' ) ) . '" title="' . esc_attr( __( 'View Documentation', 'woocommerce-gateway-stripe' ) ) . '">' . __( 'Docs', 'woocommerce-gateway-stripe' ) . '</a>',
246
-						'support' => '<a href="' . esc_url( apply_filters( 'woocommerce_gateway_stripe_support_url', 'https://woocommerce.com/my-account/create-a-ticket?select=18627' ) ) . '" title="' . esc_attr( __( 'Open a support request at WooCommerce.com', 'woocommerce-gateway-stripe' ) ) . '">' . __( 'Support', 'woocommerce-gateway-stripe' ) . '</a>',
245
+						'docs'    => '<a href="' . esc_url(apply_filters('woocommerce_gateway_stripe_docs_url', 'https://docs.woocommerce.com/document/stripe/')) . '" title="' . esc_attr(__('View Documentation', 'woocommerce-gateway-stripe')) . '">' . __('Docs', 'woocommerce-gateway-stripe') . '</a>',
246
+						'support' => '<a href="' . esc_url(apply_filters('woocommerce_gateway_stripe_support_url', 'https://woocommerce.com/my-account/create-a-ticket?select=18627')) . '" title="' . esc_attr(__('Open a support request at WooCommerce.com', 'woocommerce-gateway-stripe')) . '">' . __('Support', 'woocommerce-gateway-stripe') . '</a>',
247 247
 					);
248
-					return array_merge( $links, $row_meta );
248
+					return array_merge($links, $row_meta);
249 249
 				}
250 250
 				return (array) $links;
251 251
 			}
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 			 * @since 1.0.0
257 257
 			 * @version 4.0.0
258 258
 			 */
259
-			public function add_gateways( $methods ) {
260
-				if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) {
259
+			public function add_gateways($methods) {
260
+				if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) {
261 261
 					$methods[] = 'WC_Stripe_Subs_Compat';
262 262
 					$methods[] = 'WC_Stripe_Sepa_Subs_Compat';
263 263
 				} else {
@@ -283,28 +283,28 @@  discard block
 block discarded – undo
283 283
 			 * @since 4.0.0
284 284
 			 * @version 4.0.0
285 285
 			 */
286
-			public function filter_gateway_order_admin( $sections ) {
287
-				unset( $sections['stripe'] );
288
-				unset( $sections['stripe_bancontact'] );
289
-				unset( $sections['stripe_sofort'] );
290
-				unset( $sections['stripe_giropay'] );
291
-				unset( $sections['stripe_eps'] );
292
-				unset( $sections['stripe_ideal'] );
293
-				unset( $sections['stripe_p24'] );
294
-				unset( $sections['stripe_alipay'] );
295
-				unset( $sections['stripe_sepa'] );
296
-				unset( $sections['stripe_multibanco'] );
286
+			public function filter_gateway_order_admin($sections) {
287
+				unset($sections['stripe']);
288
+				unset($sections['stripe_bancontact']);
289
+				unset($sections['stripe_sofort']);
290
+				unset($sections['stripe_giropay']);
291
+				unset($sections['stripe_eps']);
292
+				unset($sections['stripe_ideal']);
293
+				unset($sections['stripe_p24']);
294
+				unset($sections['stripe_alipay']);
295
+				unset($sections['stripe_sepa']);
296
+				unset($sections['stripe_multibanco']);
297 297
 
298 298
 				$sections['stripe']            = 'Stripe';
299
-				$sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' );
300
-				$sections['stripe_sofort']     = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' );
301
-				$sections['stripe_giropay']    = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' );
302
-				$sections['stripe_eps']        = __( 'Stripe EPS', 'woocommerce-gateway-stripe' );
303
-				$sections['stripe_ideal']      = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' );
304
-				$sections['stripe_p24']        = __( 'Stripe P24', 'woocommerce-gateway-stripe' );
305
-				$sections['stripe_alipay']     = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' );
306
-				$sections['stripe_sepa']       = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' );
307
-				$sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' );
299
+				$sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe');
300
+				$sections['stripe_sofort']     = __('Stripe SOFORT', 'woocommerce-gateway-stripe');
301
+				$sections['stripe_giropay']    = __('Stripe Giropay', 'woocommerce-gateway-stripe');
302
+				$sections['stripe_eps']        = __('Stripe EPS', 'woocommerce-gateway-stripe');
303
+				$sections['stripe_ideal']      = __('Stripe iDeal', 'woocommerce-gateway-stripe');
304
+				$sections['stripe_p24']        = __('Stripe P24', 'woocommerce-gateway-stripe');
305
+				$sections['stripe_alipay']     = __('Stripe Alipay', 'woocommerce-gateway-stripe');
306
+				$sections['stripe_sepa']       = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe');
307
+				$sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe');
308 308
 
309 309
 				return $sections;
310 310
 			}
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
 			 * @param array|bool $old_settings Existing settings, if any.
320 320
 			 * @return array New value but with defaults initially filled in for missing settings.
321 321
 			 */
322
-			public function gateway_settings_update( $settings, $old_settings ) {
323
-				if ( false === $old_settings ) {
322
+			public function gateway_settings_update($settings, $old_settings) {
323
+				if (false === $old_settings) {
324 324
 					$gateway  = new WC_Gateway_Stripe();
325 325
 					$fields   = $gateway->get_form_fields();
326
-					$defaults = array_merge( array_fill_keys( array_keys( $fields ), '' ), wp_list_pluck( $fields, 'default' ) );
327
-					return array_merge( $defaults, $settings );
326
+					$defaults = array_merge(array_fill_keys(array_keys($fields), ''), wp_list_pluck($fields, 'default'));
327
+					return array_merge($defaults, $settings);
328 328
 				}
329 329
 				return $settings;
330 330
 			}
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
 			 * @param WC_Email[] $email_classes All existing emails.
336 336
 			 * @return WC_Email[]
337 337
 			 */
338
-			public function add_emails( $email_classes ) {
338
+			public function add_emails($email_classes) {
339 339
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php';
340 340
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php';
341 341
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php';
342 342
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php';
343 343
 
344 344
 				// Add all emails, generated by the gateway.
345
-				$email_classes['WC_Stripe_Email_Failed_Renewal_Authentication']  = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes );
346
-				$email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes );
347
-				$email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes );
345
+				$email_classes['WC_Stripe_Email_Failed_Renewal_Authentication']  = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes);
346
+				$email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes);
347
+				$email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes);
348 348
 
349 349
 				return $email_classes;
350 350
 			}
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-init-controller.php';
359 359
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-connect-controller.php';
360 360
 
361
-				$oauth_init    = new WC_Stripe_Connect_REST_Oauth_Init_Controller( $this->connect, $this->api );
362
-				$oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller( $this->connect, $this->api );
361
+				$oauth_init    = new WC_Stripe_Connect_REST_Oauth_Init_Controller($this->connect, $this->api);
362
+				$oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller($this->connect, $this->api);
363 363
 
364 364
 				$oauth_init->register_routes();
365 365
 				$oauth_connect->register_routes();
@@ -373,18 +373,18 @@  discard block
 block discarded – undo
373 373
 	return $plugin;
374 374
 }
375 375
 
376
-add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' );
376
+add_action('plugins_loaded', 'woocommerce_gateway_stripe_init');
377 377
 
378 378
 function woocommerce_gateway_stripe_init() {
379
-	load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
379
+	load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages');
380 380
 
381
-	if ( ! class_exists( 'WooCommerce' ) ) {
382
-		add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' );
381
+	if ( ! class_exists('WooCommerce')) {
382
+		add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice');
383 383
 		return;
384 384
 	}
385 385
 
386
-	if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) {
387
-		add_action( 'admin_notices', 'woocommerce_stripe_wc_not_supported' );
386
+	if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) {
387
+		add_action('admin_notices', 'woocommerce_stripe_wc_not_supported');
388 388
 		return;
389 389
 	}
390 390
 
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-order.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @param int $order_id ID of the order to delete.
19 19
 	 */
20
-	public static function delete_order( $order_id ) {
20
+	public static function delete_order($order_id) {
21 21
 
22
-		$order = wc_get_order( $order_id );
22
+		$order = wc_get_order($order_id);
23 23
 
24 24
 		// Delete all products in the order.
25
-		foreach ( $order->get_items() as $item ) {
26
-			WC_Helper_Product::delete_product( $item['product_id'] );
25
+		foreach ($order->get_items() as $item) {
26
+			WC_Helper_Product::delete_product($item['product_id']);
27 27
 		}
28 28
 
29 29
 		WC_Helper_Shipping::delete_simple_flat_rate();
30 30
 
31 31
 		// Delete the order post.
32
-		$order->delete( true );
32
+		$order->delete(true);
33 33
 	}
34 34
 
35 35
 	/**
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return WC_Order
47 47
 	 */
48
-	public static function create_order( $customer_id = 1, $total = 50, $product = null ) {
48
+	public static function create_order($customer_id = 1, $total = 50, $product = null) {
49 49
 
50
-		if ( ! is_a( $product, 'WC_Product' ) ) {
50
+		if ( ! is_a($product, 'WC_Product')) {
51 51
 			$product = WC_Helper_Product::create_simple_product();
52 52
 		}
53 53
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		];
62 62
 
63 63
 		$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; // Required, else wc_create_order throws an exception.
64
-		$order                  = wc_create_order( $order_data );
64
+		$order                  = wc_create_order($order_data);
65 65
 
66 66
 		// Add order products.
67 67
 		$item = new WC_Order_Item_Product();
@@ -69,54 +69,54 @@  discard block
 block discarded – undo
69 69
 			[
70 70
 				'product'  => $product,
71 71
 				'quantity' => 4,
72
-				'subtotal' => wc_get_price_excluding_tax( $product, [ 'qty' => 4 ] ),
73
-				'total'    => wc_get_price_excluding_tax( $product, [ 'qty' => 4 ] ),
72
+				'subtotal' => wc_get_price_excluding_tax($product, ['qty' => 4]),
73
+				'total'    => wc_get_price_excluding_tax($product, ['qty' => 4]),
74 74
 			]
75 75
 		);
76 76
 		$item->save();
77
-		$order->add_item( $item );
77
+		$order->add_item($item);
78 78
 
79 79
 		// Set billing address.
80
-		$order->set_billing_first_name( 'Jeroen' );
81
-		$order->set_billing_last_name( 'Sormani' );
82
-		$order->set_billing_company( 'WooCompany' );
83
-		$order->set_billing_address_1( 'WooAddress' );
84
-		$order->set_billing_address_2( '' );
85
-		$order->set_billing_city( 'WooCity' );
86
-		$order->set_billing_state( 'NY' );
87
-		$order->set_billing_postcode( '12345' );
88
-		$order->set_billing_country( 'US' );
89
-		$order->set_billing_email( '[email protected]' );
90
-		$order->set_billing_phone( '555-32123' );
80
+		$order->set_billing_first_name('Jeroen');
81
+		$order->set_billing_last_name('Sormani');
82
+		$order->set_billing_company('WooCompany');
83
+		$order->set_billing_address_1('WooAddress');
84
+		$order->set_billing_address_2('');
85
+		$order->set_billing_city('WooCity');
86
+		$order->set_billing_state('NY');
87
+		$order->set_billing_postcode('12345');
88
+		$order->set_billing_country('US');
89
+		$order->set_billing_email('[email protected]');
90
+		$order->set_billing_phone('555-32123');
91 91
 
92 92
 		// Add shipping costs.
93
-		$shipping_taxes = WC_Tax::calc_shipping_tax( '10', WC_Tax::get_shipping_tax_rates() );
94
-		$rate           = new WC_Shipping_Rate( 'flat_rate_shipping', 'Flat rate shipping', '10', $shipping_taxes, 'flat_rate' );
93
+		$shipping_taxes = WC_Tax::calc_shipping_tax('10', WC_Tax::get_shipping_tax_rates());
94
+		$rate           = new WC_Shipping_Rate('flat_rate_shipping', 'Flat rate shipping', '10', $shipping_taxes, 'flat_rate');
95 95
 		$item           = new WC_Order_Item_Shipping();
96 96
 		$item->set_props(
97 97
 			[
98 98
 				'method_title' => $rate->label,
99 99
 				'method_id'    => $rate->id,
100
-				'total'        => wc_format_decimal( $rate->cost ),
100
+				'total'        => wc_format_decimal($rate->cost),
101 101
 				'taxes'        => $rate->taxes,
102 102
 			]
103 103
 		);
104
-		foreach ( $rate->get_meta_data() as $key => $value ) {
105
-			$item->add_meta_data( $key, $value, true );
104
+		foreach ($rate->get_meta_data() as $key => $value) {
105
+			$item->add_meta_data($key, $value, true);
106 106
 		}
107
-		$order->add_item( $item );
107
+		$order->add_item($item);
108 108
 
109 109
 		// Set payment gateway.
110 110
 		$payment_gateways = WC()->payment_gateways->payment_gateways();
111
-		$order->set_payment_method( $payment_gateways['bacs'] );
111
+		$order->set_payment_method($payment_gateways['bacs']);
112 112
 
113 113
 		// Set totals.
114
-		$order->set_shipping_total( 10 );
115
-		$order->set_discount_total( 0 );
116
-		$order->set_discount_tax( 0 );
117
-		$order->set_cart_tax( 0 );
118
-		$order->set_shipping_tax( 0 );
119
-		$order->set_total( $total );
114
+		$order->set_shipping_total(10);
115
+		$order->set_discount_total(0);
116
+		$order->set_discount_tax(0);
117
+		$order->set_cart_tax(0);
118
+		$order->set_shipping_tax(0);
119
+		$order->set_total($total);
120 120
 		$order->save();
121 121
 
122 122
 		return $order;
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-subscriptions-cart.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 		return self::$cart_contains_subscription_result;
23 23
 	}
24 24
 
25
-	public static function set_cart_contains_subscription( $result ) {
25
+	public static function set_cart_contains_subscription($result) {
26 26
 		self::$cart_contains_subscription_result = $result;
27 27
 	}
28 28
 }
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-subscription.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
 	 */
19 19
 	public $related_orders;
20 20
 
21
-	public function get_related_orders( $type ) {
21
+	public function get_related_orders($type) {
22 22
 		return $this->related_orders;
23 23
 	}
24 24
 
25
-	public function set_related_orders( $array ) {
25
+	public function set_related_orders($array) {
26 26
 		$this->related_orders = $array;
27 27
 	}
28 28
 }
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-product.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @param int $product_id ID to delete.
19 19
 	 */
20
-	public static function delete_product( $product_id ) {
21
-		$product = wc_get_product( $product_id );
22
-		if ( $product ) {
23
-			$product->delete( true );
20
+	public static function delete_product($product_id) {
21
+		$product = wc_get_product($product_id);
22
+		if ($product) {
23
+			$product->delete(true);
24 24
 		}
25 25
 	}
26 26
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param bool $save Save or return object.
32 32
 	 * @return WC_Product_Simple
33 33
 	 */
34
-	public static function create_simple_product( $save = true ) {
34
+	public static function create_simple_product($save = true) {
35 35
 		$product = new WC_Product_Simple();
36 36
 		$product->set_props(
37 37
 			[
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 			]
49 49
 		);
50 50
 
51
-		if ( $save ) {
51
+		if ($save) {
52 52
 			$product->save();
53
-			return wc_get_product( $product->get_id() );
53
+			return wc_get_product($product->get_id());
54 54
 		} else {
55 55
 			return $product;
56 56
 		}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		);
76 76
 		$product->save();
77 77
 
78
-		return wc_get_product( $product->get_id() );
78
+		return wc_get_product($product->get_id());
79 79
 	}
80 80
 
81 81
 	/**
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 				'sku'  => 'DUMMY GROUPED SKU',
95 95
 			]
96 96
 		);
97
-		$product->set_children( [ $simple_product_1->get_id(), $simple_product_2->get_id() ] );
97
+		$product->set_children([$simple_product_1->get_id(), $simple_product_2->get_id()]);
98 98
 		$product->save();
99 99
 
100
-		return wc_get_product( $product->get_id() );
100
+		return wc_get_product($product->get_id());
101 101
 	}
102 102
 
103 103
 	/**
@@ -119,36 +119,36 @@  discard block
 block discarded – undo
119 119
 		$attributes = [];
120 120
 
121 121
 		$attribute      = new WC_Product_Attribute();
122
-		$attribute_data = self::create_attribute( 'size', [ 'small', 'large', 'huge' ] );
123
-		$attribute->set_id( $attribute_data['attribute_id'] );
124
-		$attribute->set_name( $attribute_data['attribute_taxonomy'] );
125
-		$attribute->set_options( $attribute_data['term_ids'] );
126
-		$attribute->set_position( 1 );
127
-		$attribute->set_visible( true );
128
-		$attribute->set_variation( true );
122
+		$attribute_data = self::create_attribute('size', ['small', 'large', 'huge']);
123
+		$attribute->set_id($attribute_data['attribute_id']);
124
+		$attribute->set_name($attribute_data['attribute_taxonomy']);
125
+		$attribute->set_options($attribute_data['term_ids']);
126
+		$attribute->set_position(1);
127
+		$attribute->set_visible(true);
128
+		$attribute->set_variation(true);
129 129
 		$attributes[] = $attribute;
130 130
 
131 131
 		$attribute      = new WC_Product_Attribute();
132
-		$attribute_data = self::create_attribute( 'colour', [ 'red', 'blue' ] );
133
-		$attribute->set_id( $attribute_data['attribute_id'] );
134
-		$attribute->set_name( $attribute_data['attribute_taxonomy'] );
135
-		$attribute->set_options( $attribute_data['term_ids'] );
136
-		$attribute->set_position( 1 );
137
-		$attribute->set_visible( true );
138
-		$attribute->set_variation( true );
132
+		$attribute_data = self::create_attribute('colour', ['red', 'blue']);
133
+		$attribute->set_id($attribute_data['attribute_id']);
134
+		$attribute->set_name($attribute_data['attribute_taxonomy']);
135
+		$attribute->set_options($attribute_data['term_ids']);
136
+		$attribute->set_position(1);
137
+		$attribute->set_visible(true);
138
+		$attribute->set_variation(true);
139 139
 		$attributes[] = $attribute;
140 140
 
141 141
 		$attribute      = new WC_Product_Attribute();
142
-		$attribute_data = self::create_attribute( 'number', [ '0', '1', '2' ] );
143
-		$attribute->set_id( $attribute_data['attribute_id'] );
144
-		$attribute->set_name( $attribute_data['attribute_taxonomy'] );
145
-		$attribute->set_options( $attribute_data['term_ids'] );
146
-		$attribute->set_position( 1 );
147
-		$attribute->set_visible( true );
148
-		$attribute->set_variation( true );
142
+		$attribute_data = self::create_attribute('number', ['0', '1', '2']);
143
+		$attribute->set_id($attribute_data['attribute_id']);
144
+		$attribute->set_name($attribute_data['attribute_taxonomy']);
145
+		$attribute->set_options($attribute_data['term_ids']);
146
+		$attribute->set_position(1);
147
+		$attribute->set_visible(true);
148
+		$attribute->set_variation(true);
149 149
 		$attributes[] = $attribute;
150 150
 
151
-		$product->set_attributes( $attributes );
151
+		$product->set_attributes($attributes);
152 152
 		$product->save();
153 153
 
154 154
 		$variation_1 = new WC_Product_Variation();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				'regular_price' => 10,
160 160
 			]
161 161
 		);
162
-		$variation_1->set_attributes( [ 'pa_size' => 'small' ] );
162
+		$variation_1->set_attributes(['pa_size' => 'small']);
163 163
 		$variation_1->save();
164 164
 
165 165
 		$variation_2 = new WC_Product_Variation();
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 				'regular_price' => 15,
171 171
 			]
172 172
 		);
173
-		$variation_2->set_attributes( [ 'pa_size' => 'large' ] );
173
+		$variation_2->set_attributes(['pa_size' => 'large']);
174 174
 		$variation_2->save();
175 175
 
176 176
 		$variation_3 = new WC_Product_Variation();
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		);
208 208
 		$variation_4->save();
209 209
 
210
-		return wc_get_product( $product->get_id() );
210
+		return wc_get_product($product->get_id());
211 211
 	}
212 212
 
213 213
 	/**
@@ -219,28 +219,28 @@  discard block
 block discarded – undo
219 219
 	 * @param array(string) $terms          Terms to create for the attribute.
220 220
 	 * @return array
221 221
 	 */
222
-	public static function create_attribute( $raw_name = 'size', $terms = [ 'small' ] ) {
222
+	public static function create_attribute($raw_name = 'size', $terms = ['small']) {
223 223
 		global $wpdb, $wc_product_attributes;
224 224
 
225 225
 		// Make sure caches are clean.
226
-		delete_transient( 'wc_attribute_taxonomies' );
227
-		WC_Cache_Helper::invalidate_cache_group( 'woocommerce-attributes' );
226
+		delete_transient('wc_attribute_taxonomies');
227
+		WC_Cache_Helper::invalidate_cache_group('woocommerce-attributes');
228 228
 
229 229
 		// These are exported as labels, so convert the label to a name if possible first.
230
-		$attribute_labels = wp_list_pluck( wc_get_attribute_taxonomies(), 'attribute_label', 'attribute_name' );
231
-		$attribute_name   = array_search( $raw_name, $attribute_labels, true );
230
+		$attribute_labels = wp_list_pluck(wc_get_attribute_taxonomies(), 'attribute_label', 'attribute_name');
231
+		$attribute_name   = array_search($raw_name, $attribute_labels, true);
232 232
 
233
-		if ( ! $attribute_name ) {
234
-			$attribute_name = wc_sanitize_taxonomy_name( $raw_name );
233
+		if ( ! $attribute_name) {
234
+			$attribute_name = wc_sanitize_taxonomy_name($raw_name);
235 235
 		}
236 236
 
237
-		$attribute_id = wc_attribute_taxonomy_id_by_name( $attribute_name );
237
+		$attribute_id = wc_attribute_taxonomy_id_by_name($attribute_name);
238 238
 
239
-		if ( ! $attribute_id ) {
240
-			$taxonomy_name = wc_attribute_taxonomy_name( $attribute_name );
239
+		if ( ! $attribute_id) {
240
+			$taxonomy_name = wc_attribute_taxonomy_name($attribute_name);
241 241
 
242 242
 			// Degister taxonomy which other tests may have created...
243
-			unregister_taxonomy( $taxonomy_name );
243
+			unregister_taxonomy($taxonomy_name);
244 244
 
245 245
 			$attribute_id = wc_create_attribute(
246 246
 				[
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			// Register as taxonomy.
256 256
 			register_taxonomy(
257 257
 				$taxonomy_name,
258
-				apply_filters( 'woocommerce_taxonomy_objects_' . $taxonomy_name, [ 'product' ] ),
258
+				apply_filters('woocommerce_taxonomy_objects_' . $taxonomy_name, ['product']),
259 259
 				apply_filters(
260 260
 					'woocommerce_taxonomy_args_' . $taxonomy_name,
261 261
 					[
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 			// Set product attributes global.
274 274
 			$wc_product_attributes = [];
275 275
 
276
-			foreach ( wc_get_attribute_taxonomies() as $taxonomy ) {
277
-				$wc_product_attributes[ wc_attribute_taxonomy_name( $taxonomy->attribute_name ) ] = $taxonomy;
276
+			foreach (wc_get_attribute_taxonomies() as $taxonomy) {
277
+				$wc_product_attributes[wc_attribute_taxonomy_name($taxonomy->attribute_name)] = $taxonomy;
278 278
 			}
279 279
 		}
280 280
 
281
-		$attribute = wc_get_attribute( $attribute_id );
281
+		$attribute = wc_get_attribute($attribute_id);
282 282
 		$return    = [
283 283
 			'attribute_name'     => $attribute->name,
284 284
 			'attribute_taxonomy' => $attribute->slug,
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 			'term_ids'           => [],
287 287
 		];
288 288
 
289
-		foreach ( $terms as $term ) {
290
-			$result = term_exists( $term, $attribute->slug );
289
+		foreach ($terms as $term) {
290
+			$result = term_exists($term, $attribute->slug);
291 291
 
292
-			if ( ! $result ) {
293
-				$result               = wp_insert_term( $term, $attribute->slug );
292
+			if ( ! $result) {
293
+				$result               = wp_insert_term($term, $attribute->slug);
294 294
 				$return['term_ids'][] = $result['term_id'];
295 295
 			} else {
296 296
 				$return['term_ids'][] = $result['term_id'];
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @since 2.3
309 309
 	 */
310
-	public static function delete_attribute( $attribute_id ) {
310
+	public static function delete_attribute($attribute_id) {
311 311
 		global $wpdb;
312 312
 
313
-		$attribute_id = absint( $attribute_id );
313
+		$attribute_id = absint($attribute_id);
314 314
 
315 315
 		$wpdb->query(
316
-			$wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = %d", $attribute_id )
316
+			$wpdb->prepare("DELETE FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = %d", $attribute_id)
317 317
 		);
318 318
 	}
319 319
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @param string $review_content string Content to use for the product review.
326 326
 	 * @return integer Product Review ID.
327 327
 	 */
328
-	public static function create_product_review( $product_id, $review_content = 'Review content here' ) {
328
+	public static function create_product_review($product_id, $review_content = 'Review content here') {
329 329
 		$data = [
330 330
 			'comment_post_ID'      => $product_id,
331 331
 			'comment_author'       => 'admin',
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 			'comment_approved'     => 1,
337 337
 			'comment_type'         => 'review',
338 338
 		];
339
-		return wp_insert_comment( $data );
339
+		return wp_insert_comment($data);
340 340
 	}
341 341
 
342 342
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @param int $id ID to update.
347 347
 	 */
348
-	public static function save_post_test_update_meta_data_direct( $id ) {
349
-		update_post_meta( $id, '_test2', 'world' );
348
+	public static function save_post_test_update_meta_data_direct($id) {
349
+		update_post_meta($id, '_test2', 'world');
350 350
 	}
351 351
 }
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-shipping.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 			'cost'         => '10',
28 28
 		];
29 29
 
30
-		update_option( 'woocommerce_flat_rate_settings', $flat_rate_settings );
31
-		update_option( 'woocommerce_flat_rate', [] );
32
-		WC_Cache_Helper::get_transient_version( 'shipping', true );
30
+		update_option('woocommerce_flat_rate_settings', $flat_rate_settings);
31
+		update_option('woocommerce_flat_rate', []);
32
+		WC_Cache_Helper::get_transient_version('shipping', true);
33 33
 		WC()->shipping()->load_shipping_methods();
34 34
 	}
35 35
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @since 2.3
40 40
 	 */
41 41
 	public static function delete_simple_flat_rate() {
42
-		delete_option( 'woocommerce_flat_rate_settings' );
43
-		delete_option( 'woocommerce_flat_rate' );
44
-		WC_Cache_Helper::get_transient_version( 'shipping', true );
42
+		delete_option('woocommerce_flat_rate_settings');
43
+		delete_option('woocommerce_flat_rate');
44
+		WC_Cache_Helper::get_transient_version('shipping', true);
45 45
 		WC()->shipping()->unregister_shipping_methods();
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-token.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@
 block discarded – undo
19 19
 	 * @param int    $user_id        ID of the token's user, defaults to get_current_user_id().
20 20
 	 * @param string $gateway        Token's Gateway ID, default to WC_Payment_Gateway_WCPay::GATEWAY_ID
21 21
 	 */
22
-	public static function create_token( $payment_method, $user_id = null, $gateway = WC_Payment_Gateway_WCPay::GATEWAY_ID ) {
22
+	public static function create_token($payment_method, $user_id = null, $gateway = WC_Payment_Gateway_WCPay::GATEWAY_ID) {
23 23
 		$token = new WC_Payment_Token_CC();
24
-		$token->set_token( $payment_method );
25
-		$token->set_gateway_id( $gateway );
26
-		$token->set_user_id( isset ( $user_id ) ? $user_id : get_current_user_id() );
27
-		$token->set_card_type( 'visa' );
28
-		$token->set_last4( '4242' );
29
-		$token->set_expiry_month( 6 );
30
-		$token->set_expiry_year( intval( gmdate( 'Y' ) ) + 1 );
24
+		$token->set_token($payment_method);
25
+		$token->set_gateway_id($gateway);
26
+		$token->set_user_id(isset ($user_id) ? $user_id : get_current_user_id());
27
+		$token->set_card_type('visa');
28
+		$token->set_last4('4242');
29
+		$token->set_expiry_month(6);
30
+		$token->set_expiry_year(intval(gmdate('Y')) + 1);
31 31
 		$token->save();
32 32
 
33
-		return WC_Payment_Tokens::get( $token->get_id() );
33
+		return WC_Payment_Tokens::get($token->get_id());
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
tests/phpunit/helpers/class-wc-helper-subscriptions.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,32 +6,32 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Set up subscriptions mocks.
9
-function wcs_order_contains_subscription( $order ) {
10
-	if ( ! WC_Subscriptions::$wcs_order_contains_subscription ) {
9
+function wcs_order_contains_subscription($order) {
10
+	if ( ! WC_Subscriptions::$wcs_order_contains_subscription) {
11 11
 		return;
12 12
 	}
13
-	return call_user_func(  WC_Subscriptions::$wcs_order_contains_subscription, $order );
13
+	return call_user_func(WC_Subscriptions::$wcs_order_contains_subscription, $order);
14 14
 }
15 15
 
16
-function wcs_get_subscriptions_for_order( $order ) {
17
-	if ( ! WC_Subscriptions::$wcs_get_subscriptions_for_order ) {
16
+function wcs_get_subscriptions_for_order($order) {
17
+	if ( ! WC_Subscriptions::$wcs_get_subscriptions_for_order) {
18 18
 		return;
19 19
 	}
20
-	return call_user_func(  WC_Subscriptions::$wcs_get_subscriptions_for_order, $order );
20
+	return call_user_func(WC_Subscriptions::$wcs_get_subscriptions_for_order, $order);
21 21
 }
22 22
 
23
-function wcs_is_subscription( $order ) {
24
-	if ( ! WC_Subscriptions::$wcs_is_subscription ) {
23
+function wcs_is_subscription($order) {
24
+	if ( ! WC_Subscriptions::$wcs_is_subscription) {
25 25
 		return;
26 26
 	}
27
-	return call_user_func(  WC_Subscriptions::$wcs_is_subscription, $order );
27
+	return call_user_func(WC_Subscriptions::$wcs_is_subscription, $order);
28 28
 }
29 29
 
30
-function wcs_get_subscription( $subscription ) {
31
-	if ( ! WC_Subscriptions::$wcs_get_subscription ) {
30
+function wcs_get_subscription($subscription) {
31
+	if ( ! WC_Subscriptions::$wcs_get_subscription) {
32 32
 		return;
33 33
 	}
34
-	return call_user_func(  WC_Subscriptions::$wcs_get_subscription, $subscription );
34
+	return call_user_func(WC_Subscriptions::$wcs_get_subscription, $subscription);
35 35
 }
36 36
 
37 37
 /**
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public static $wcs_get_subscription = null;
77 77
 
78
-	public static function set_wcs_order_contains_subscription( $function ) {
78
+	public static function set_wcs_order_contains_subscription($function) {
79 79
 		self::$wcs_order_contains_subscription = $function;
80 80
 	}
81 81
 
82
-	public static function set_wcs_get_subscriptions_for_order( $function ) {
82
+	public static function set_wcs_get_subscriptions_for_order($function) {
83 83
 		self::$wcs_get_subscriptions_for_order = $function;
84 84
 	}
85 85
 
86
-	public static function set_wcs_is_subscription( $function ) {
86
+	public static function set_wcs_is_subscription($function) {
87 87
 		self::$wcs_is_subscription = $function;
88 88
 	}
89 89
 
90
-	public static function set_wcs_get_subscription( $function ) {
90
+	public static function set_wcs_get_subscription($function) {
91 91
 		self::$wcs_get_subscription = $function;
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.