Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
plugins/woocommerce/packages/action-scheduler/classes/migration/Config.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @return ActionScheduler_Store
49 49
 	 */
50 50
 	public function get_source_store() {
51
-		if ( empty( $this->source_store ) ) {
52
-			throw new \RuntimeException( __( 'Source store must be configured before running a migration', 'woocommerce' ) );
51
+		if (empty($this->source_store)) {
52
+			throw new \RuntimeException(__('Source store must be configured before running a migration', 'woocommerce'));
53 53
 		}
54 54
 
55 55
 		return $this->source_store;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param ActionScheduler_Store $store Source store object.
62 62
 	 */
63
-	public function set_source_store( Store $store ) {
63
+	public function set_source_store(Store $store) {
64 64
 		$this->source_store = $store;
65 65
 	}
66 66
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 * @return ActionScheduler_Logger
71 71
 	 */
72 72
 	public function get_source_logger() {
73
-		if ( empty( $this->source_logger ) ) {
74
-			throw new \RuntimeException( __( 'Source logger must be configured before running a migration', 'woocommerce' ) );
73
+		if (empty($this->source_logger)) {
74
+			throw new \RuntimeException(__('Source logger must be configured before running a migration', 'woocommerce'));
75 75
 		}
76 76
 
77 77
 		return $this->source_logger;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @param ActionScheduler_Logger $logger
84 84
 	 */
85
-	public function set_source_logger( Logger $logger ) {
85
+	public function set_source_logger(Logger $logger) {
86 86
 		$this->source_logger = $logger;
87 87
 	}
88 88
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @return ActionScheduler_Store
93 93
 	 */
94 94
 	public function get_destination_store() {
95
-		if ( empty( $this->destination_store ) ) {
96
-			throw new \RuntimeException( __( 'Destination store must be configured before running a migration', 'woocommerce' ) );
95
+		if (empty($this->destination_store)) {
96
+			throw new \RuntimeException(__('Destination store must be configured before running a migration', 'woocommerce'));
97 97
 		}
98 98
 
99 99
 		return $this->destination_store;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @param ActionScheduler_Store $store
106 106
 	 */
107
-	public function set_destination_store( Store $store ) {
107
+	public function set_destination_store(Store $store) {
108 108
 		$this->destination_store = $store;
109 109
 	}
110 110
 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @return ActionScheduler_Logger
115 115
 	 */
116 116
 	public function get_destination_logger() {
117
-		if ( empty( $this->destination_logger ) ) {
118
-			throw new \RuntimeException( __( 'Destination logger must be configured before running a migration', 'woocommerce' ) );
117
+		if (empty($this->destination_logger)) {
118
+			throw new \RuntimeException(__('Destination logger must be configured before running a migration', 'woocommerce'));
119 119
 		}
120 120
 
121 121
 		return $this->destination_logger;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param ActionScheduler_Logger $logger
128 128
 	 */
129
-	public function set_destination_logger( Logger $logger ) {
129
+	public function set_destination_logger(Logger $logger) {
130 130
 		$this->destination_logger = $logger;
131 131
 	}
132 132
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param bool $dry_run
146 146
 	 */
147
-	public function set_dry_run( $dry_run ) {
147
+	public function set_dry_run($dry_run) {
148 148
 		$this->dry_run = (bool) $dry_run;
149 149
 	}
150 150
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @param ActionScheduler\WPCLI\ProgressBar $progress_bar
164 164
 	 */
165
-	public function set_progress_bar( ProgressBar $progress_bar ) {
165
+	public function set_progress_bar(ProgressBar $progress_bar) {
166 166
 		$this->progress_bar = $progress_bar;
167 167
 	}
168 168
 }
Please login to merge, or discard this patch.
woocommerce/packages/action-scheduler/classes/migration/BatchFetcher.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param ActionScheduler_Store $source_store Source store object.
26 26
 	 */
27
-	public function __construct( Store $source_store ) {
27
+	public function __construct(Store $source_store) {
28 28
 		$this->store = $source_store;
29 29
 	}
30 30
 
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return int[] A list of action IDs
37 37
 	 */
38
-	public function fetch( $count = 10 ) {
39
-		foreach ( $this->get_query_strategies( $count ) as $query ) {
40
-			$action_ids = $this->store->query_actions( $query );
41
-			if ( ! empty( $action_ids ) ) {
38
+	public function fetch($count = 10) {
39
+		foreach ($this->get_query_strategies($count) as $query) {
40
+			$action_ids = $this->store->query_actions($query);
41
+			if (!empty($action_ids)) {
42 42
 				return $action_ids;
43 43
 			}
44 44
 		}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return array
55 55
 	 */
56
-	private function get_query_strategies( $count ) {
56
+	private function get_query_strategies($count) {
57 57
 		$now  = as_get_datetime_object();
58 58
 		$args = [
59 59
 			'date'     => $now,
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 			'', // any other unanticipated status
73 73
 		];
74 74
 
75
-		foreach ( $priorities as $status ) {
76
-			yield wp_parse_args( [
75
+		foreach ($priorities as $status) {
76
+			yield wp_parse_args([
77 77
 				'status'       => $status,
78 78
 				'date_compare' => '<=',
79
-			], $args );
80
-			yield wp_parse_args( [
79
+			], $args);
80
+			yield wp_parse_args([
81 81
 				'status'       => $status,
82 82
 				'date_compare' => '>=',
83
-			], $args );
83
+			], $args);
84 84
 		}
85 85
 	}
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
woocommerce/packages/action-scheduler/classes/migration/Controller.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param Scheduler $migration_scheduler Migration scheduler object.
40 40
 	 */
41
-	protected function __construct( Scheduler $migration_scheduler ) {
41
+	protected function __construct(Scheduler $migration_scheduler) {
42 42
 		$this->migration_scheduler = $migration_scheduler;
43 43
 		$this->store_classname     = '';
44 44
 	}
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return string
52 52
 	 */
53
-	public function get_store_class( $class ) {
54
-		if ( \ActionScheduler_DataController::is_migration_complete() ) {
53
+	public function get_store_class($class) {
54
+		if (\ActionScheduler_DataController::is_migration_complete()) {
55 55
 			return \ActionScheduler_DataController::DATASTORE_CLASS;
56
-		} elseif ( \ActionScheduler_Store::DEFAULT_CLASS !== $class ) {
56
+		} elseif (\ActionScheduler_Store::DEFAULT_CLASS !== $class) {
57 57
 			$this->store_classname = $class;
58 58
 			return $class;
59 59
 		} else {
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @return string
70 70
 	 */
71
-	public function get_logger_class( $class ) {
71
+	public function get_logger_class($class) {
72 72
 		\ActionScheduler_Store::instance();
73 73
 
74
-		if ( $this->has_custom_datastore() ) {
74
+		if ($this->has_custom_datastore()) {
75 75
 			$this->logger_classname = $class;
76 76
 			return $class;
77 77
 		} else {
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 		if (
111 111
 			ActionScheduler_DataController::is_migration_complete()
112 112
 			|| $this->migration_scheduler->is_migration_scheduled()
113
-			|| ! $store_tables->tables_exist()
114
-			|| ! $logging_tables->tables_exist()
113
+			|| !$store_tables->tables_exist()
114
+			|| !$logging_tables->tables_exist()
115 115
 		) {
116 116
 			return;
117 117
 		}
@@ -127,53 +127,53 @@  discard block
 block discarded – undo
127 127
 	public function get_migration_config_object() {
128 128
 		static $config = null;
129 129
 
130
-		if ( ! $config ) {
130
+		if (!$config) {
131 131
 			$source_store  = $this->store_classname ? new $this->store_classname() : new \ActionScheduler_wpPostStore();
132 132
 			$source_logger = $this->logger_classname ? new $this->logger_classname() : new \ActionScheduler_wpCommentLogger();
133 133
 
134 134
 			$config = new Config();
135
-			$config->set_source_store( $source_store );
136
-			$config->set_source_logger( $source_logger );
137
-			$config->set_destination_store( new \ActionScheduler_DBStoreMigrator() );
138
-			$config->set_destination_logger( new \ActionScheduler_DBLogger() );
135
+			$config->set_source_store($source_store);
136
+			$config->set_source_logger($source_logger);
137
+			$config->set_destination_store(new \ActionScheduler_DBStoreMigrator());
138
+			$config->set_destination_logger(new \ActionScheduler_DBLogger());
139 139
 
140
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
141
-				$config->set_progress_bar( new ProgressBar( '', 0 ) );
140
+			if (defined('WP_CLI') && WP_CLI) {
141
+				$config->set_progress_bar(new ProgressBar('', 0));
142 142
 			}
143 143
 		}
144 144
 
145
-		return apply_filters( 'action_scheduler/migration_config', $config );
145
+		return apply_filters('action_scheduler/migration_config', $config);
146 146
 	}
147 147
 
148 148
 	/**
149 149
 	 * Hook dashboard migration notice.
150 150
 	 */
151 151
 	public function hook_admin_notices() {
152
-		if ( ! $this->allow_migration() || \ActionScheduler_DataController::is_migration_complete() ) {
152
+		if (!$this->allow_migration() || \ActionScheduler_DataController::is_migration_complete()) {
153 153
 			return;
154 154
 		}
155
-		add_action( 'admin_notices', array( $this, 'display_migration_notice' ), 10, 0 );
155
+		add_action('admin_notices', array($this, 'display_migration_notice'), 10, 0);
156 156
 	}
157 157
 
158 158
 	/**
159 159
 	 * Show a dashboard notice that migration is in progress.
160 160
 	 */
161 161
 	public function display_migration_notice() {
162
-		printf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html__( 'Action Scheduler migration in progress. The list of scheduled actions may be incomplete.', 'woocommerce' ) );
162
+		printf('<div class="notice notice-warning"><p>%s</p></div>', esc_html__('Action Scheduler migration in progress. The list of scheduled actions may be incomplete.', 'woocommerce'));
163 163
 	}
164 164
 
165 165
 	/**
166 166
 	 * Add store classes. Hook migration.
167 167
 	 */
168 168
 	private function hook() {
169
-		add_filter( 'action_scheduler_store_class', array( $this, 'get_store_class' ), 100, 1 );
170
-		add_filter( 'action_scheduler_logger_class', array( $this, 'get_logger_class' ), 100, 1 );
171
-		add_action( 'init', array( $this, 'maybe_hook_migration' ) );
172
-		add_action( 'wp_loaded', array( $this, 'schedule_migration' ) );
169
+		add_filter('action_scheduler_store_class', array($this, 'get_store_class'), 100, 1);
170
+		add_filter('action_scheduler_logger_class', array($this, 'get_logger_class'), 100, 1);
171
+		add_action('init', array($this, 'maybe_hook_migration'));
172
+		add_action('wp_loaded', array($this, 'schedule_migration'));
173 173
 
174 174
 		// Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen
175
-		add_action( 'load-tools_page_action-scheduler', array( $this, 'hook_admin_notices' ), 10, 0 );
176
-		add_action( 'load-woocommerce_page_wc-status', array( $this, 'hook_admin_notices' ), 10, 0 );
175
+		add_action('load-tools_page_action-scheduler', array($this, 'hook_admin_notices'), 10, 0);
176
+		add_action('load-woocommerce_page_wc-status', array($this, 'hook_admin_notices'), 10, 0);
177 177
 	}
178 178
 
179 179
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @author Jeremy Pry
183 183
 	 */
184 184
 	public function maybe_hook_migration() {
185
-		if ( ! $this->allow_migration() || \ActionScheduler_DataController::is_migration_complete() ) {
185
+		if (!$this->allow_migration() || \ActionScheduler_DataController::is_migration_complete()) {
186 186
 			return;
187 187
 		}
188 188
 
@@ -193,22 +193,22 @@  discard block
 block discarded – undo
193 193
 	 * Allow datastores to enable migration to AS tables.
194 194
 	 */
195 195
 	public function allow_migration() {
196
-		if ( ! \ActionScheduler_DataController::dependencies_met() ) {
196
+		if (!\ActionScheduler_DataController::dependencies_met()) {
197 197
 			return false;
198 198
 		}
199 199
 
200
-		if ( null === $this->migrate_custom_store ) {
201
-			$this->migrate_custom_store = apply_filters( 'action_scheduler_migrate_data_store', false );
200
+		if (null === $this->migrate_custom_store) {
201
+			$this->migrate_custom_store = apply_filters('action_scheduler_migrate_data_store', false);
202 202
 		}
203 203
 
204
-		return ( ! $this->has_custom_datastore() ) || $this->migrate_custom_store;
204
+		return (!$this->has_custom_datastore()) || $this->migrate_custom_store;
205 205
 	}
206 206
 
207 207
 	/**
208 208
 	 * Proceed with the migration if the dependencies have been met.
209 209
 	 */
210 210
 	public static function init() {
211
-		if ( \ActionScheduler_DataController::dependencies_met() ) {
211
+		if (\ActionScheduler_DataController::dependencies_met()) {
212 212
 			self::instance()->hook();
213 213
 		}
214 214
 	}
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	 * Singleton factory.
218 218
 	 */
219 219
 	public static function instance() {
220
-		if ( ! isset( self::$instance ) ) {
221
-			self::$instance = new static( new Scheduler() );
220
+		if (!isset(self::$instance)) {
221
+			self::$instance = new static(new Scheduler());
222 222
 		}
223 223
 
224 224
 		return self::$instance;
Please login to merge, or discard this patch.
woocommerce/packages/action-scheduler/classes/migration/LogMigrator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @param ActionScheduler_Logger $source_logger Source logger object.
28 28
 	 * @param ActionScheduler_Logger $destination_Logger Destination logger object.
29 29
 	 */
30
-	public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_Logger ) {
30
+	public function __construct(ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_Logger) {
31 31
 		$this->source      = $source_logger;
32 32
 		$this->destination = $destination_Logger;
33 33
 	}
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 	 * @param int $source_action_id Source logger object.
39 39
 	 * @param int $destination_action_id Destination logger object.
40 40
 	 */
41
-	public function migrate( $source_action_id, $destination_action_id ) {
42
-		$logs = $this->source->get_logs( $source_action_id );
43
-		foreach ( $logs as $log ) {
44
-			if ( $log->get_action_id() == $source_action_id ) {
45
-				$this->destination->log( $destination_action_id, $log->get_message(), $log->get_date() );
41
+	public function migrate($source_action_id, $destination_action_id) {
42
+		$logs = $this->source->get_logs($source_action_id);
43
+		foreach ($logs as $log) {
44
+			if ($log->get_action_id() == $source_action_id) {
45
+				$this->destination->log($destination_action_id, $log->get_message(), $log->get_date());
46 46
 			}
47 47
 		}
48 48
 	}
Please login to merge, or discard this patch.
action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@
 block discarded – undo
23 23
 	 * @return string The action ID
24 24
 	 * @throws \RuntimeException When the action is not saved.
25 25
 	 */
26
-	public function save_action( ActionScheduler_Action $action, \DateTime $scheduled_date = null, \DateTime $last_attempt_date = null ){
26
+	public function save_action(ActionScheduler_Action $action, \DateTime $scheduled_date = null, \DateTime $last_attempt_date = null) {
27 27
 		try {
28 28
 			/** @var \wpdb $wpdb */
29 29
 			global $wpdb;
30 30
 
31
-			$action_id = parent::save_action( $action, $scheduled_date );
31
+			$action_id = parent::save_action($action, $scheduled_date);
32 32
 
33
-			if ( null !== $last_attempt_date ) {
33
+			if (null !== $last_attempt_date) {
34 34
 				$data = [
35
-					'last_attempt_gmt'   => $this->get_scheduled_date_string( $action, $last_attempt_date ),
36
-					'last_attempt_local' => $this->get_scheduled_date_string_local( $action, $last_attempt_date ),
35
+					'last_attempt_gmt'   => $this->get_scheduled_date_string($action, $last_attempt_date),
36
+					'last_attempt_local' => $this->get_scheduled_date_string_local($action, $last_attempt_date),
37 37
 				];
38 38
 
39
-				$wpdb->update( $wpdb->actionscheduler_actions, $data, array( 'action_id' => $action_id ), array( '%s', '%s' ), array( '%d' ) );
39
+				$wpdb->update($wpdb->actionscheduler_actions, $data, array('action_id' => $action_id), array('%s', '%s'), array('%d'));
40 40
 			}
41 41
 
42 42
 			return $action_id;
43
-		} catch ( \Exception $e ) {
44
-			throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'woocommerce' ), $e->getMessage() ), 0 );
43
+		} catch (\Exception $e) {
44
+			throw new \RuntimeException(sprintf(__('Error saving action: %s', 'woocommerce'), $e->getMessage()), 0);
45 45
 		}
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
packages/action-scheduler/classes/migration/DryRun_LogMigrator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 	 * @param int $source_action_id Source logger object.
18 18
 	 * @param int $destination_action_id Destination logger object.
19 19
 	 */
20
-	public function migrate( $source_action_id, $destination_action_id ) {
20
+	public function migrate($source_action_id, $destination_action_id) {
21 21
 		// no-op
22 22
 	}
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
woocommerce/packages/action-scheduler/classes/ActionScheduler_ListTable.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
 	 * @param ActionScheduler_Logger $logger
81 81
 	 * @param ActionScheduler_QueueRunner $runner
82 82
 	 */
83
-	public function __construct( ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner ) {
83
+	public function __construct(ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner) {
84 84
 
85 85
 		$this->store  = $store;
86 86
 		$this->logger = $logger;
87 87
 		$this->runner = $runner;
88 88
 
89
-		$this->table_header = __( 'Scheduled Actions', 'woocommerce' );
89
+		$this->table_header = __('Scheduled Actions', 'woocommerce');
90 90
 
91 91
 		$this->bulk_actions = array(
92
-			'delete' => __( 'Delete', 'woocommerce' ),
92
+			'delete' => __('Delete', 'woocommerce'),
93 93
 		);
94 94
 
95 95
 		$this->columns = array(
96
-			'hook'        => __( 'Hook', 'woocommerce' ),
97
-			'status'      => __( 'Status', 'woocommerce' ),
98
-			'args'        => __( 'Arguments', 'woocommerce' ),
99
-			'group'       => __( 'Group', 'woocommerce' ),
100
-			'recurrence'  => __( 'Recurrence', 'woocommerce' ),
101
-			'schedule'    => __( 'Scheduled Date', 'woocommerce' ),
102
-			'log_entries' => __( 'Log', 'woocommerce' ),
96
+			'hook'        => __('Hook', 'woocommerce'),
97
+			'status'      => __('Status', 'woocommerce'),
98
+			'args'        => __('Arguments', 'woocommerce'),
99
+			'group'       => __('Group', 'woocommerce'),
100
+			'recurrence'  => __('Recurrence', 'woocommerce'),
101
+			'schedule'    => __('Scheduled Date', 'woocommerce'),
102
+			'log_entries' => __('Log', 'woocommerce'),
103 103
 		);
104 104
 
105 105
 		$this->sort_by = array(
@@ -116,22 +116,22 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$request_status = $this->get_request_status();
118 118
 
119
-		if ( empty( $request_status ) ) {
119
+		if (empty($request_status)) {
120 120
 			$this->sort_by[] = 'status';
121
-		} elseif ( in_array( $request_status, array( 'in-progress', 'failed' ) ) ) {
122
-			$this->columns  += array( 'claim_id' => __( 'Claim ID', 'woocommerce' ) );
121
+		} elseif (in_array($request_status, array('in-progress', 'failed'))) {
122
+			$this->columns  += array('claim_id' => __('Claim ID', 'woocommerce'));
123 123
 			$this->sort_by[] = 'claim_id';
124 124
 		}
125 125
 
126 126
 		$this->row_actions = array(
127 127
 			'hook' => array(
128 128
 				'run' => array(
129
-					'name'  => __( 'Run', 'woocommerce' ),
130
-					'desc'  => __( 'Process the action now as if it were run as part of a queue', 'woocommerce' ),
129
+					'name'  => __('Run', 'woocommerce'),
130
+					'desc'  => __('Process the action now as if it were run as part of a queue', 'woocommerce'),
131 131
 				),
132 132
 				'cancel' => array(
133
-					'name'  => __( 'Cancel', 'woocommerce' ),
134
-					'desc'  => __( 'Cancel the action now to avoid it being run in future', 'woocommerce' ),
133
+					'name'  => __('Cancel', 'woocommerce'),
134
+					'desc'  => __('Cancel the action now to avoid it being run in future', 'woocommerce'),
135 135
 					'class' => 'cancel trash',
136 136
 				),
137 137
 			),
@@ -141,37 +141,37 @@  discard block
 block discarded – undo
141 141
 			array(
142 142
 				'seconds' => YEAR_IN_SECONDS,
143 143
 				/* translators: %s: amount of time */
144
-				'names'   => _n_noop( '%s year', '%s years', 'woocommerce' ),
144
+				'names'   => _n_noop('%s year', '%s years', 'woocommerce'),
145 145
 			),
146 146
 			array(
147 147
 				'seconds' => MONTH_IN_SECONDS,
148 148
 				/* translators: %s: amount of time */
149
-				'names'   => _n_noop( '%s month', '%s months', 'woocommerce' ),
149
+				'names'   => _n_noop('%s month', '%s months', 'woocommerce'),
150 150
 			),
151 151
 			array(
152 152
 				'seconds' => WEEK_IN_SECONDS,
153 153
 				/* translators: %s: amount of time */
154
-				'names'   => _n_noop( '%s week', '%s weeks', 'woocommerce' ),
154
+				'names'   => _n_noop('%s week', '%s weeks', 'woocommerce'),
155 155
 			),
156 156
 			array(
157 157
 				'seconds' => DAY_IN_SECONDS,
158 158
 				/* translators: %s: amount of time */
159
-				'names'   => _n_noop( '%s day', '%s days', 'woocommerce' ),
159
+				'names'   => _n_noop('%s day', '%s days', 'woocommerce'),
160 160
 			),
161 161
 			array(
162 162
 				'seconds' => HOUR_IN_SECONDS,
163 163
 				/* translators: %s: amount of time */
164
-				'names'   => _n_noop( '%s hour', '%s hours', 'woocommerce' ),
164
+				'names'   => _n_noop('%s hour', '%s hours', 'woocommerce'),
165 165
 			),
166 166
 			array(
167 167
 				'seconds' => MINUTE_IN_SECONDS,
168 168
 				/* translators: %s: amount of time */
169
-				'names'   => _n_noop( '%s minute', '%s minutes', 'woocommerce' ),
169
+				'names'   => _n_noop('%s minute', '%s minutes', 'woocommerce'),
170 170
 			),
171 171
 			array(
172 172
 				'seconds' => 1,
173 173
 				/* translators: %s: amount of time */
174
-				'names'   => _n_noop( '%s second', '%s seconds', 'woocommerce' ),
174
+				'names'   => _n_noop('%s second', '%s seconds', 'woocommerce'),
175 175
 			),
176 176
 		);
177 177
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			)
191 191
 		);
192 192
 
193
-		add_filter( 'set_screen_option_' . $this->get_per_page_option_name(), array( $this, 'set_items_per_page_option' ), 10, 3 );
193
+		add_filter('set_screen_option_' . $this->get_per_page_option_name(), array($this, 'set_items_per_page_option'), 10, 3);
194 194
 		set_screen_options();
195 195
 	}
196 196
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @param int    $value  Screen option value.
203 203
 	 * @return int
204 204
 	 */
205
-	public function set_items_per_page_option( $status, $option, $value ) {
205
+	public function set_items_per_page_option($status, $option, $value) {
206 206
 		return $value;
207 207
 	}
208 208
 	/**
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
 	 * @param int $periods_to_include Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included.
219 219
 	 * @return string A human friendly string representation of the interval.
220 220
 	 */
221
-	private static function human_interval( $interval, $periods_to_include = 2 ) {
221
+	private static function human_interval($interval, $periods_to_include = 2) {
222 222
 
223
-		if ( $interval <= 0 ) {
224
-			return __( 'Now!', 'woocommerce' );
223
+		if ($interval <= 0) {
224
+			return __('Now!', 'woocommerce');
225 225
 		}
226 226
 
227 227
 		$output = '';
228 228
 
229
-		for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count( self::$time_periods ) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) {
229
+		for ($time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count(self::$time_periods) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++) {
230 230
 
231
-			$periods_in_interval = floor( $seconds_remaining / self::$time_periods[ $time_period_index ]['seconds'] );
231
+			$periods_in_interval = floor($seconds_remaining / self::$time_periods[$time_period_index]['seconds']);
232 232
 
233
-			if ( $periods_in_interval > 0 ) {
234
-				if ( ! empty( $output ) ) {
233
+			if ($periods_in_interval > 0) {
234
+				if (!empty($output)) {
235 235
 					$output .= ' ';
236 236
 				}
237
-				$output .= sprintf( _n( self::$time_periods[ $time_period_index ]['names'][0], self::$time_periods[ $time_period_index ]['names'][1], $periods_in_interval, 'woocommerce' ), $periods_in_interval );
238
-				$seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds'];
237
+				$output .= sprintf(_n(self::$time_periods[$time_period_index]['names'][0], self::$time_periods[$time_period_index]['names'][1], $periods_in_interval, 'woocommerce'), $periods_in_interval);
238
+				$seconds_remaining -= $periods_in_interval * self::$time_periods[$time_period_index]['seconds'];
239 239
 				$periods_included++;
240 240
 			}
241 241
 		}
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return string
252 252
 	 */
253
-	protected function get_recurrence( $action ) {
253
+	protected function get_recurrence($action) {
254 254
 		$schedule = $action->get_schedule();
255
-		if ( $schedule->is_recurring() ) {
255
+		if ($schedule->is_recurring()) {
256 256
 			$recurrence = $schedule->get_recurrence();
257 257
 
258
-			if ( is_numeric( $recurrence ) ) {
258
+			if (is_numeric($recurrence)) {
259 259
 				/* translators: %s: time interval */
260
-				return sprintf( __( 'Every %s', 'woocommerce' ), self::human_interval( $recurrence ) );
260
+				return sprintf(__('Every %s', 'woocommerce'), self::human_interval($recurrence));
261 261
 			} else {
262 262
 				return $recurrence;
263 263
 			}
264 264
 		}
265 265
 
266
-		return __( 'Non-repeating', 'woocommerce' );
266
+		return __('Non-repeating', 'woocommerce');
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return string
275 275
 	 */
276
-	public function column_args( array $row ) {
277
-		if ( empty( $row['args'] ) ) {
278
-			return apply_filters( 'action_scheduler_list_table_column_args', '', $row );
276
+	public function column_args(array $row) {
277
+		if (empty($row['args'])) {
278
+			return apply_filters('action_scheduler_list_table_column_args', '', $row);
279 279
 		}
280 280
 
281 281
 		$row_html = '<ul>';
282
-		foreach ( $row['args'] as $key => $value ) {
283
-			$row_html .= sprintf( '<li><code>%s => %s</code></li>', esc_html( var_export( $key, true ) ), esc_html( var_export( $value, true ) ) );
282
+		foreach ($row['args'] as $key => $value) {
283
+			$row_html .= sprintf('<li><code>%s => %s</code></li>', esc_html(var_export($key, true)), esc_html(var_export($value, true)));
284 284
 		}
285 285
 		$row_html .= '</ul>';
286 286
 
287
-		return apply_filters( 'action_scheduler_list_table_column_args', $row_html, $row );
287
+		return apply_filters('action_scheduler_list_table_column_args', $row_html, $row);
288 288
 	}
289 289
 
290 290
 	/**
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 	 * @param array $row Action array.
294 294
 	 * @return string
295 295
 	 */
296
-	public function column_log_entries( array $row ) {
296
+	public function column_log_entries(array $row) {
297 297
 
298 298
 		$log_entries_html = '<ol>';
299 299
 
300
-		$timezone = new DateTimezone( 'UTC' );
300
+		$timezone = new DateTimezone('UTC');
301 301
 
302
-		foreach ( $row['log_entries'] as $log_entry ) {
303
-			$log_entries_html .= $this->get_log_entry_html( $log_entry, $timezone );
302
+		foreach ($row['log_entries'] as $log_entry) {
303
+			$log_entries_html .= $this->get_log_entry_html($log_entry, $timezone);
304 304
 		}
305 305
 
306 306
 		$log_entries_html .= '</ol>';
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 	 * @param DateTimezone $timezone
316 316
 	 * @return string
317 317
 	 */
318
-	protected function get_log_entry_html( ActionScheduler_LogEntry $log_entry, DateTimezone $timezone ) {
318
+	protected function get_log_entry_html(ActionScheduler_LogEntry $log_entry, DateTimezone $timezone) {
319 319
 		$date = $log_entry->get_date();
320
-		$date->setTimezone( $timezone );
321
-		return sprintf( '<li><strong>%s</strong><br/>%s</li>', esc_html( $date->format( 'Y-m-d H:i:s O' ) ), esc_html( $log_entry->get_message() ) );
320
+		$date->setTimezone($timezone);
321
+		return sprintf('<li><strong>%s</strong><br/>%s</li>', esc_html($date->format('Y-m-d H:i:s O')), esc_html($log_entry->get_message()));
322 322
 	}
323 323
 
324 324
 	/**
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 *
330 330
 	 * @return string
331 331
 	 */
332
-	protected function maybe_render_actions( $row, $column_name ) {
333
-		if ( 'pending' === strtolower( $row[ 'status_name' ] ) ) {
334
-			return parent::maybe_render_actions( $row, $column_name );
332
+	protected function maybe_render_actions($row, $column_name) {
333
+		if ('pending' === strtolower($row['status_name'])) {
334
+			return parent::maybe_render_actions($row, $column_name);
335 335
 		}
336 336
 
337 337
 		return '';
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	public function display_admin_notices() {
349 349
 		global $wpdb;
350 350
 
351
-		if ( ( is_a( $this->store, 'ActionScheduler_HybridStore' ) || is_a( $this->store, 'ActionScheduler_DBStore' ) ) && apply_filters( 'action_scheduler_enable_recreate_data_store', true ) ) {
351
+		if ((is_a($this->store, 'ActionScheduler_HybridStore') || is_a($this->store, 'ActionScheduler_DBStore')) && apply_filters('action_scheduler_enable_recreate_data_store', true)) {
352 352
 			$table_list = array(
353 353
 				'actionscheduler_actions',
354 354
 				'actionscheduler_logs',
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 				'actionscheduler_claims',
357 357
 			);
358 358
 
359
-			$found_tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}actionscheduler%'" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
360
-			foreach ( $table_list as $table_name ) {
361
-				if ( ! in_array( $wpdb->prefix . $table_name, $found_tables ) ) {
359
+			$found_tables = $wpdb->get_col("SHOW TABLES LIKE '{$wpdb->prefix}actionscheduler%'"); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
360
+			foreach ($table_list as $table_name) {
361
+				if (!in_array($wpdb->prefix . $table_name, $found_tables)) {
362 362
 					$this->admin_notices[] = array(
363 363
 						'class'   => 'error',
364
-						'message' => __( 'It appears one or more database tables were missing. Attempting to re-create the missing table(s).' , 'woocommerce' ),
364
+						'message' => __('It appears one or more database tables were missing. Attempting to re-create the missing table(s).', 'woocommerce'),
365 365
 					);
366 366
 					$this->recreate_tables();
367 367
 					parent::display_admin_notices();
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			}
372 372
 		}
373 373
 
374
-		if ( $this->runner->has_maximum_concurrent_batches() ) {
374
+		if ($this->runner->has_maximum_concurrent_batches()) {
375 375
 			$claim_count           = $this->store->get_claim_count();
376 376
 			$this->admin_notices[] = array(
377 377
 				'class'   => 'updated',
@@ -386,18 +386,18 @@  discard block
 block discarded – undo
386 386
 					$claim_count
387 387
 				),
388 388
 			);
389
-		} elseif ( $this->store->has_pending_actions_due() ) {
389
+		} elseif ($this->store->has_pending_actions_due()) {
390 390
 
391
-			$async_request_lock_expiration = ActionScheduler::lock()->get_expiration( 'async-request-runner' );
391
+			$async_request_lock_expiration = ActionScheduler::lock()->get_expiration('async-request-runner');
392 392
 
393 393
 			// No lock set or lock expired
394
-			if ( false === $async_request_lock_expiration || $async_request_lock_expiration < time() ) {
395
-				$in_progress_url       = add_query_arg( 'status', 'in-progress', remove_query_arg( 'status' ) );
394
+			if (false === $async_request_lock_expiration || $async_request_lock_expiration < time()) {
395
+				$in_progress_url       = add_query_arg('status', 'in-progress', remove_query_arg('status'));
396 396
 				/* translators: %s: process URL */
397
-				$async_request_message = sprintf( __( 'A new queue has begun processing. <a href="%s">View actions in-progress &raquo;</a>', 'woocommerce' ), esc_url( $in_progress_url ) );
397
+				$async_request_message = sprintf(__('A new queue has begun processing. <a href="%s">View actions in-progress &raquo;</a>', 'woocommerce'), esc_url($in_progress_url));
398 398
 			} else {
399 399
 				/* translators: %d: seconds */
400
-				$async_request_message = sprintf( __( 'The next queue will begin processing in approximately %d seconds.', 'woocommerce' ), $async_request_lock_expiration - time() );
400
+				$async_request_message = sprintf(__('The next queue will begin processing in approximately %d seconds.', 'woocommerce'), $async_request_lock_expiration - time());
401 401
 			}
402 402
 
403 403
 			$this->admin_notices[] = array(
@@ -406,36 +406,36 @@  discard block
 block discarded – undo
406 406
 			);
407 407
 		}
408 408
 
409
-		$notification = get_transient( 'action_scheduler_admin_notice' );
409
+		$notification = get_transient('action_scheduler_admin_notice');
410 410
 
411
-		if ( is_array( $notification ) ) {
412
-			delete_transient( 'action_scheduler_admin_notice' );
411
+		if (is_array($notification)) {
412
+			delete_transient('action_scheduler_admin_notice');
413 413
 
414
-			$action = $this->store->fetch_action( $notification['action_id'] );
414
+			$action = $this->store->fetch_action($notification['action_id']);
415 415
 			$action_hook_html = '<strong><code>' . $action->get_hook() . '</code></strong>';
416
-			if ( 1 == $notification['success'] ) {
416
+			if (1 == $notification['success']) {
417 417
 				$class = 'updated';
418
-				switch ( $notification['row_action_type'] ) {
418
+				switch ($notification['row_action_type']) {
419 419
 					case 'run' :
420 420
 						/* translators: %s: action HTML */
421
-						$action_message_html = sprintf( __( 'Successfully executed action: %s', 'woocommerce' ), $action_hook_html );
421
+						$action_message_html = sprintf(__('Successfully executed action: %s', 'woocommerce'), $action_hook_html);
422 422
 						break;
423 423
 					case 'cancel' :
424 424
 						/* translators: %s: action HTML */
425
-						$action_message_html = sprintf( __( 'Successfully canceled action: %s', 'woocommerce' ), $action_hook_html );
425
+						$action_message_html = sprintf(__('Successfully canceled action: %s', 'woocommerce'), $action_hook_html);
426 426
 						break;
427 427
 					default :
428 428
 						/* translators: %s: action HTML */
429
-						$action_message_html = sprintf( __( 'Successfully processed change for action: %s', 'woocommerce' ), $action_hook_html );
429
+						$action_message_html = sprintf(__('Successfully processed change for action: %s', 'woocommerce'), $action_hook_html);
430 430
 						break;
431 431
 				}
432 432
 			} else {
433 433
 				$class = 'error';
434 434
 				/* translators: 1: action HTML 2: action ID 3: error message */
435
-				$action_message_html = sprintf( __( 'Could not process change for action: "%1$s" (ID: %2$d). Error: %3$s', 'woocommerce' ), $action_hook_html, esc_html( $notification['action_id'] ), esc_html( $notification['error_message'] ) );
435
+				$action_message_html = sprintf(__('Could not process change for action: "%1$s" (ID: %2$d). Error: %3$s', 'woocommerce'), $action_hook_html, esc_html($notification['action_id']), esc_html($notification['error_message']));
436 436
 			}
437 437
 
438
-			$action_message_html = apply_filters( 'action_scheduler_admin_notice_html', $action_message_html, $action, $notification );
438
+			$action_message_html = apply_filters('action_scheduler_admin_notice_html', $action_message_html, $action, $notification);
439 439
 
440 440
 			$this->admin_notices[] = array(
441 441
 				'class'   => $class,
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return string
455 455
 	 */
456
-	public function column_schedule( $row ) {
457
-		return $this->get_schedule_display_string( $row['schedule'] );
456
+	public function column_schedule($row) {
457
+		return $this->get_schedule_display_string($row['schedule']);
458 458
 	}
459 459
 
460 460
 	/**
@@ -463,25 +463,25 @@  discard block
 block discarded – undo
463 463
 	 * @param ActionScheduler_Schedule $schedule
464 464
 	 * @return string
465 465
 	 */
466
-	protected function get_schedule_display_string( ActionScheduler_Schedule $schedule ) {
466
+	protected function get_schedule_display_string(ActionScheduler_Schedule $schedule) {
467 467
 
468 468
 		$schedule_display_string = '';
469 469
 
470
-		if ( ! $schedule->get_date() ) {
470
+		if (!$schedule->get_date()) {
471 471
 			return '0000-00-00 00:00:00';
472 472
 		}
473 473
 
474 474
 		$next_timestamp = $schedule->get_date()->getTimestamp();
475 475
 
476
-		$schedule_display_string .= $schedule->get_date()->format( 'Y-m-d H:i:s O' );
476
+		$schedule_display_string .= $schedule->get_date()->format('Y-m-d H:i:s O');
477 477
 		$schedule_display_string .= '<br/>';
478 478
 
479
-		if ( gmdate( 'U' ) > $next_timestamp ) {
479
+		if (gmdate('U') > $next_timestamp) {
480 480
 			/* translators: %s: date interval */
481
-			$schedule_display_string .= sprintf( __( ' (%s ago)', 'woocommerce' ), self::human_interval( gmdate( 'U' ) - $next_timestamp ) );
481
+			$schedule_display_string .= sprintf(__(' (%s ago)', 'woocommerce'), self::human_interval(gmdate('U') - $next_timestamp));
482 482
 		} else {
483 483
 			/* translators: %s: date interval */
484
-			$schedule_display_string .= sprintf( __( ' (%s)', 'woocommerce' ), self::human_interval( $next_timestamp - gmdate( 'U' ) ) );
484
+			$schedule_display_string .= sprintf(__(' (%s)', 'woocommerce'), self::human_interval($next_timestamp - gmdate('U')));
485 485
 		}
486 486
 
487 487
 		return $schedule_display_string;
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 	 * @param array $ids
497 497
 	 * @param string $ids_sql Inherited and unused
498 498
 	 */
499
-	protected function bulk_delete( array $ids, $ids_sql ) {
500
-		foreach ( $ids as $id ) {
501
-			$this->store->delete_action( $id );
499
+	protected function bulk_delete(array $ids, $ids_sql) {
500
+		foreach ($ids as $id) {
501
+			$this->store->delete_action($id);
502 502
 		}
503 503
 	}
504 504
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @param int $action_id
510 510
 	 */
511
-	protected function row_action_cancel( $action_id ) {
512
-		$this->process_row_action( $action_id, 'cancel' );
511
+	protected function row_action_cancel($action_id) {
512
+		$this->process_row_action($action_id, 'cancel');
513 513
 	}
514 514
 
515 515
 	/**
@@ -518,27 +518,27 @@  discard block
 block discarded – undo
518 518
 	 *
519 519
 	 * @param int $action_id
520 520
 	 */
521
-	protected function row_action_run( $action_id ) {
522
-		$this->process_row_action( $action_id, 'run' );
521
+	protected function row_action_run($action_id) {
522
+		$this->process_row_action($action_id, 'run');
523 523
 	}
524 524
 
525 525
 	/**
526 526
 	 * Force the data store schema updates.
527 527
 	 */
528 528
 	protected function recreate_tables() {
529
-		if ( is_a( $this->store, 'ActionScheduler_HybridStore' ) ) {
529
+		if (is_a($this->store, 'ActionScheduler_HybridStore')) {
530 530
 			$store = $this->store;
531 531
 		} else {
532 532
 			$store = new ActionScheduler_HybridStore();
533 533
 		}
534
-		add_action( 'action_scheduler/created_table', array( $store, 'set_autoincrement' ), 10, 2 );
534
+		add_action('action_scheduler/created_table', array($store, 'set_autoincrement'), 10, 2);
535 535
 
536 536
 		$store_schema  = new ActionScheduler_StoreSchema();
537 537
 		$logger_schema = new ActionScheduler_LoggerSchema();
538
-		$store_schema->register_tables( true );
539
-		$logger_schema->register_tables( true );
538
+		$store_schema->register_tables(true);
539
+		$logger_schema->register_tables(true);
540 540
 
541
-		remove_action( 'action_scheduler/created_table', array( $store, 'set_autoincrement' ), 10 );
541
+		remove_action('action_scheduler/created_table', array($store, 'set_autoincrement'), 10);
542 542
 	}
543 543
 	/**
544 544
 	 * Implements the logic behind processing an action once an action link is clicked on the list table.
@@ -546,24 +546,24 @@  discard block
 block discarded – undo
546 546
 	 * @param int $action_id
547 547
 	 * @param string $row_action_type The type of action to perform on the action.
548 548
 	 */
549
-	protected function process_row_action( $action_id, $row_action_type ) {
549
+	protected function process_row_action($action_id, $row_action_type) {
550 550
 		try {
551
-			switch ( $row_action_type ) {
551
+			switch ($row_action_type) {
552 552
 				case 'run' :
553
-					$this->runner->process_action( $action_id, 'Admin List Table' );
553
+					$this->runner->process_action($action_id, 'Admin List Table');
554 554
 					break;
555 555
 				case 'cancel' :
556
-					$this->store->cancel_action( $action_id );
556
+					$this->store->cancel_action($action_id);
557 557
 					break;
558 558
 			}
559 559
 			$success = 1;
560 560
 			$error_message = '';
561
-		} catch ( Exception $e ) {
561
+		} catch (Exception $e) {
562 562
 			$success = 0;
563 563
 			$error_message = $e->getMessage();
564 564
 		}
565 565
 
566
-		set_transient( 'action_scheduler_admin_notice', compact( 'action_id', 'success', 'error_message', 'row_action_type' ), 30 );
566
+		set_transient('action_scheduler_admin_notice', compact('action_id', 'success', 'error_message', 'row_action_type'), 30);
567 567
 	}
568 568
 
569 569
 	/**
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	public function prepare_items() {
573 573
 		$this->prepare_column_headers();
574 574
 
575
-		$per_page = $this->get_items_per_page( $this->get_per_page_option_name(), $this->items_per_page );
575
+		$per_page = $this->get_items_per_page($this->get_per_page_option_name(), $this->items_per_page);
576 576
 
577 577
 		$query = array(
578 578
 			'per_page' => $per_page,
@@ -585,38 +585,38 @@  discard block
 block discarded – undo
585 585
 
586 586
 		$this->items = array();
587 587
 
588
-		$total_items = $this->store->query_actions( $query, 'count' );
588
+		$total_items = $this->store->query_actions($query, 'count');
589 589
 
590 590
 		$status_labels = $this->store->get_status_labels();
591 591
 
592
-		foreach ( $this->store->query_actions( $query ) as $action_id ) {
592
+		foreach ($this->store->query_actions($query) as $action_id) {
593 593
 			try {
594
-				$action = $this->store->fetch_action( $action_id );
595
-			} catch ( Exception $e ) {
594
+				$action = $this->store->fetch_action($action_id);
595
+			} catch (Exception $e) {
596 596
 				continue;
597 597
 			}
598
-			if ( is_a( $action, 'ActionScheduler_NullAction' ) ) {
598
+			if (is_a($action, 'ActionScheduler_NullAction')) {
599 599
 				continue;
600 600
 			}
601
-			$this->items[ $action_id ] = array(
601
+			$this->items[$action_id] = array(
602 602
 				'ID'          => $action_id,
603 603
 				'hook'        => $action->get_hook(),
604
-				'status_name' => $this->store->get_status( $action_id ),
605
-				'status'      => $status_labels[ $this->store->get_status( $action_id ) ],
604
+				'status_name' => $this->store->get_status($action_id),
605
+				'status'      => $status_labels[$this->store->get_status($action_id)],
606 606
 				'args'        => $action->get_args(),
607 607
 				'group'       => $action->get_group(),
608
-				'log_entries' => $this->logger->get_logs( $action_id ),
609
-				'claim_id'    => $this->store->get_claim_id( $action_id ),
610
-				'recurrence'  => $this->get_recurrence( $action ),
608
+				'log_entries' => $this->logger->get_logs($action_id),
609
+				'claim_id'    => $this->store->get_claim_id($action_id),
610
+				'recurrence'  => $this->get_recurrence($action),
611 611
 				'schedule'    => $action->get_schedule(),
612 612
 			);
613 613
 		}
614 614
 
615
-		$this->set_pagination_args( array(
615
+		$this->set_pagination_args(array(
616 616
 			'total_items' => $total_items,
617 617
 			'per_page'    => $per_page,
618
-			'total_pages' => ceil( $total_items / $per_page ),
619
-		) );
618
+			'total_pages' => ceil($total_items / $per_page),
619
+		));
620 620
 	}
621 621
 
622 622
 	/**
@@ -631,13 +631,13 @@  discard block
 block discarded – undo
631 631
 	 * Get the text to display in the search box on the list table.
632 632
 	 */
633 633
 	protected function get_search_box_button_text() {
634
-		return __( 'Search hook, args and claim ID', 'woocommerce' );
634
+		return __('Search hook, args and claim ID', 'woocommerce');
635 635
 	}
636 636
 
637 637
 	/**
638 638
 	 * {@inheritDoc}
639 639
 	 */
640 640
 	protected function get_per_page_option_name() {
641
-		return str_replace( '-', '_', $this->screen->id ) . '_per_page';
641
+		return str_replace('-', '_', $this->screen->id) . '_per_page';
642 642
 	}
643 643
 }
Please login to merge, or discard this patch.
classes/data-stores/ActionScheduler_wpPostStore_PostStatusRegistrar.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  */
7 7
 class ActionScheduler_wpPostStore_PostStatusRegistrar {
8 8
 	public function register() {
9
-		register_post_status( ActionScheduler_Store::STATUS_RUNNING, array_merge( $this->post_status_args(), $this->post_status_running_labels() ) );
10
-		register_post_status( ActionScheduler_Store::STATUS_FAILED, array_merge( $this->post_status_args(), $this->post_status_failed_labels() ) );
9
+		register_post_status(ActionScheduler_Store::STATUS_RUNNING, array_merge($this->post_status_args(), $this->post_status_running_labels()));
10
+		register_post_status(ActionScheduler_Store::STATUS_FAILED, array_merge($this->post_status_args(), $this->post_status_failed_labels()));
11 11
 	}
12 12
 
13 13
 	/**
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 			'show_in_admin_status_list' => true,
24 24
 		);
25 25
 
26
-		return apply_filters( 'action_scheduler_post_status_args', $args );
26
+		return apply_filters('action_scheduler_post_status_args', $args);
27 27
 	}
28 28
 
29 29
 	/**
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	protected function post_status_failed_labels() {
35 35
 		$labels = array(
36
-			'label'       => _x( 'Failed', 'post', 'woocommerce' ),
36
+			'label'       => _x('Failed', 'post', 'woocommerce'),
37 37
 			/* translators: %s: count */
38
-			'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'woocommerce' ),
38
+			'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'woocommerce'),
39 39
 		);
40 40
 
41
-		return apply_filters( 'action_scheduler_post_status_failed_labels', $labels );
41
+		return apply_filters('action_scheduler_post_status_failed_labels', $labels);
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	protected function post_status_running_labels() {
50 50
 		$labels = array(
51
-			'label'       => _x( 'In-Progress', 'post', 'woocommerce' ),
51
+			'label'       => _x('In-Progress', 'post', 'woocommerce'),
52 52
 			/* translators: %s: count */
53
-			'label_count' => _n_noop( 'In-Progress <span class="count">(%s)</span>', 'In-Progress <span class="count">(%s)</span>', 'woocommerce' ),
53
+			'label_count' => _n_noop('In-Progress <span class="count">(%s)</span>', 'In-Progress <span class="count">(%s)</span>', 'woocommerce'),
54 54
 		);
55 55
 
56
-		return apply_filters( 'action_scheduler_post_status_running_labels', $labels );
56
+		return apply_filters('action_scheduler_post_status_running_labels', $labels);
57 57
 	}
58 58
 }
Please login to merge, or discard this patch.
action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param Config $config Migration config object.
39 39
 	 */
40
-	public function __construct( Config $config = null ) {
41
-		$this->demarkation_id = (int) get_option( self::DEMARKATION_OPTION, 0 );
42
-		if ( empty( $config ) ) {
40
+	public function __construct(Config $config = null) {
41
+		$this->demarkation_id = (int) get_option(self::DEMARKATION_OPTION, 0);
42
+		if (empty($config)) {
43 43
 			$config = Controller::instance()->get_migration_config_object();
44 44
 		}
45 45
 		$this->primary_store    = $config->get_destination_store();
46 46
 		$this->secondary_store  = $config->get_source_store();
47
-		$this->migration_runner = new Runner( $config );
47
+		$this->migration_runner = new Runner($config);
48 48
 	}
49 49
 
50 50
 	/**
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 * @codeCoverageIgnore
54 54
 	 */
55 55
 	public function init() {
56
-		add_action( 'action_scheduler/created_table', [ $this, 'set_autoincrement' ], 10, 2 );
56
+		add_action('action_scheduler/created_table', [$this, 'set_autoincrement'], 10, 2);
57 57
 		$this->primary_store->init();
58 58
 		$this->secondary_store->init();
59
-		remove_action( 'action_scheduler/created_table', [ $this, 'set_autoincrement' ], 10 );
59
+		remove_action('action_scheduler/created_table', [$this, 'set_autoincrement'], 10);
60 60
 	}
61 61
 
62 62
 	/**
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 * @return void
71 71
 	 * @codeCoverageIgnore
72 72
 	 */
73
-	public function set_autoincrement( $table_name, $table_suffix ) {
74
-		if ( ActionScheduler_StoreSchema::ACTIONS_TABLE === $table_suffix ) {
75
-			if ( empty( $this->demarkation_id ) ) {
73
+	public function set_autoincrement($table_name, $table_suffix) {
74
+		if (ActionScheduler_StoreSchema::ACTIONS_TABLE === $table_suffix) {
75
+			if (empty($this->demarkation_id)) {
76 76
 				$this->demarkation_id = $this->set_demarkation_id();
77 77
 			}
78 78
 			/** @var \wpdb $wpdb */
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			 * A default date of '0000-00-00 00:00:00' is invalid in MySQL 5.7 when configured with 
82 82
 			 * sql_mode including both STRICT_TRANS_TABLES and NO_ZERO_DATE.
83 83
 			 */
84
-			$default_date = new DateTime( 'tomorrow' );
84
+			$default_date = new DateTime('tomorrow');
85 85
 			$null_action  = new ActionScheduler_NullAction();
86
-			$date_gmt     = $this->get_scheduled_date_string( $null_action, $default_date );
87
-			$date_local   = $this->get_scheduled_date_string_local( $null_action, $default_date );
86
+			$date_gmt     = $this->get_scheduled_date_string($null_action, $default_date);
87
+			$date_local   = $this->get_scheduled_date_string_local($null_action, $default_date);
88 88
 
89 89
 			$row_count = $wpdb->insert(
90 90
 				$wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE},
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 					'last_attempt_local'   => $date_local,
99 99
 				]
100 100
 			);
101
-			if ( $row_count > 0 ) {
101
+			if ($row_count > 0) {
102 102
 				$wpdb->delete(
103 103
 					$wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE},
104
-					[ 'action_id' => $this->demarkation_id ]
104
+					['action_id' => $this->demarkation_id]
105 105
 				);
106 106
 			}
107 107
 		}
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @codeCoverageIgnore
119 119
 	 */
120
-	private function set_demarkation_id( $id = null ) {
121
-		if ( empty( $id ) ) {
120
+	private function set_demarkation_id($id = null) {
121
+		if (empty($id)) {
122 122
 			/** @var \wpdb $wpdb */
123 123
 			global $wpdb;
124
-			$id = (int) $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" );
125
-			$id ++;
124
+			$id = (int) $wpdb->get_var("SELECT MAX(ID) FROM $wpdb->posts");
125
+			$id++;
126 126
 		}
127
-		update_option( self::DEMARKATION_OPTION, $id );
127
+		update_option(self::DEMARKATION_OPTION, $id);
128 128
 
129 129
 		return $id;
130 130
 	}
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return string
142 142
 	 */
143
-	public function find_action( $hook, $params = [] ) {
144
-		$found_unmigrated_action = $this->secondary_store->find_action( $hook, $params );
145
-		if ( ! empty( $found_unmigrated_action ) ) {
146
-			$this->migrate( [ $found_unmigrated_action ] );
143
+	public function find_action($hook, $params = []) {
144
+		$found_unmigrated_action = $this->secondary_store->find_action($hook, $params);
145
+		if (!empty($found_unmigrated_action)) {
146
+			$this->migrate([$found_unmigrated_action]);
147 147
 		}
148 148
 
149
-		return $this->primary_store->find_action( $hook, $params );
149
+		return $this->primary_store->find_action($hook, $params);
150 150
 	}
151 151
 
152 152
 	/**
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @return int[]
161 161
 	 */
162
-	public function query_actions( $query = [], $query_type = 'select' ) {
163
-		$found_unmigrated_actions = $this->secondary_store->query_actions( $query, 'select' );
164
-		if ( ! empty( $found_unmigrated_actions ) ) {
165
-			$this->migrate( $found_unmigrated_actions );
162
+	public function query_actions($query = [], $query_type = 'select') {
163
+		$found_unmigrated_actions = $this->secondary_store->query_actions($query, 'select');
164
+		if (!empty($found_unmigrated_actions)) {
165
+			$this->migrate($found_unmigrated_actions);
166 166
 		}
167 167
 
168
-		return $this->primary_store->query_actions( $query, $query_type );
168
+		return $this->primary_store->query_actions($query, $query_type);
169 169
 	}
170 170
 
171 171
 	/**
@@ -178,22 +178,22 @@  discard block
 block discarded – undo
178 178
 		$migrated_actions_count   = $this->primary_store->action_counts();
179 179
 		$actions_count_by_status  = array();
180 180
 
181
-		foreach ( $this->get_status_labels() as $status_key => $status_label ) {
181
+		foreach ($this->get_status_labels() as $status_key => $status_label) {
182 182
 
183 183
 			$count = 0;
184 184
 
185
-			if ( isset( $unmigrated_actions_count[ $status_key ] ) ) {
186
-				$count += $unmigrated_actions_count[ $status_key ];
185
+			if (isset($unmigrated_actions_count[$status_key])) {
186
+				$count += $unmigrated_actions_count[$status_key];
187 187
 			}
188 188
 
189
-			if ( isset( $migrated_actions_count[ $status_key ] ) ) {
190
-				$count += $migrated_actions_count[ $status_key ];
189
+			if (isset($migrated_actions_count[$status_key])) {
190
+				$count += $migrated_actions_count[$status_key];
191 191
 			}
192 192
 
193
-			$actions_count_by_status[ $status_key ] = $count;
193
+			$actions_count_by_status[$status_key] = $count;
194 194
 		}
195 195
 
196
-		$actions_count_by_status = array_filter( $actions_count_by_status );
196
+		$actions_count_by_status = array_filter($actions_count_by_status);
197 197
 
198 198
 		return $actions_count_by_status;
199 199
 	}
@@ -208,17 +208,17 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @return ActionScheduler_ActionClaim
210 210
 	 */
211
-	public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) {
212
-		$claim = $this->secondary_store->stake_claim( $max_actions, $before_date, $hooks, $group );
211
+	public function stake_claim($max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '') {
212
+		$claim = $this->secondary_store->stake_claim($max_actions, $before_date, $hooks, $group);
213 213
 
214 214
 		$claimed_actions = $claim->get_actions();
215
-		if ( ! empty( $claimed_actions ) ) {
216
-			$this->migrate( $claimed_actions );
215
+		if (!empty($claimed_actions)) {
216
+			$this->migrate($claimed_actions);
217 217
 		}
218 218
 
219
-		$this->secondary_store->release_claim( $claim );
219
+		$this->secondary_store->release_claim($claim);
220 220
 
221
-		return $this->primary_store->stake_claim( $max_actions, $before_date, $hooks, $group );
221
+		return $this->primary_store->stake_claim($max_actions, $before_date, $hooks, $group);
222 222
 	}
223 223
 
224 224
 	/**
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @param array $action_ids List of action IDs.
228 228
 	 */
229
-	private function migrate( $action_ids ) {
230
-		$this->migration_runner->migrate_actions( $action_ids );
229
+	private function migrate($action_ids) {
230
+		$this->migration_runner->migrate_actions($action_ids);
231 231
 	}
232 232
 
233 233
 	/**
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return int The action ID
240 240
 	 */
241
-	public function save_action( ActionScheduler_Action $action, DateTime $date = null ) {
242
-		return $this->primary_store->save_action( $action, $date );
241
+	public function save_action(ActionScheduler_Action $action, DateTime $date = null) {
242
+		return $this->primary_store->save_action($action, $date);
243 243
 	}
244 244
 
245 245
 	/**
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @param int $action_id Action ID.
249 249
 	 */
250
-	public function fetch_action( $action_id ) {
251
-		$store = $this->get_store_from_action_id( $action_id, true );
252
-		if ( $store ) {
253
-			return $store->fetch_action( $action_id );
250
+	public function fetch_action($action_id) {
251
+		$store = $this->get_store_from_action_id($action_id, true);
252
+		if ($store) {
253
+			return $store->fetch_action($action_id);
254 254
 		} else {
255 255
 			return new ActionScheduler_NullAction();
256 256
 		}
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @param int $action_id Action ID.
263 263
 	 */
264
-	public function cancel_action( $action_id ) {
265
-		$store = $this->get_store_from_action_id( $action_id );
266
-		if ( $store ) {
267
-			$store->cancel_action( $action_id );
264
+	public function cancel_action($action_id) {
265
+		$store = $this->get_store_from_action_id($action_id);
266
+		if ($store) {
267
+			$store->cancel_action($action_id);
268 268
 		}
269 269
 	}
270 270
 
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @param int $action_id Action ID.
275 275
 	 */
276
-	public function delete_action( $action_id ) {
277
-		$store = $this->get_store_from_action_id( $action_id );
278
-		if ( $store ) {
279
-			$store->delete_action( $action_id );
276
+	public function delete_action($action_id) {
277
+		$store = $this->get_store_from_action_id($action_id);
278
+		if ($store) {
279
+			$store->delete_action($action_id);
280 280
 		}
281 281
 	}
282 282
 
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @param int $action_id Action ID.
287 287
 	 */
288
-	public function get_date( $action_id ) {
289
-		$store = $this->get_store_from_action_id( $action_id );
290
-		if ( $store ) {
291
-			return $store->get_date( $action_id );
288
+	public function get_date($action_id) {
289
+		$store = $this->get_store_from_action_id($action_id);
290
+		if ($store) {
291
+			return $store->get_date($action_id);
292 292
 		} else {
293 293
 			return null;
294 294
 		}
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @param int $action_id Action ID.
301 301
 	 */
302
-	public function mark_failure( $action_id ) {
303
-		$store = $this->get_store_from_action_id( $action_id );
304
-		if ( $store ) {
305
-			$store->mark_failure( $action_id );
302
+	public function mark_failure($action_id) {
303
+		$store = $this->get_store_from_action_id($action_id);
304
+		if ($store) {
305
+			$store->mark_failure($action_id);
306 306
 		}
307 307
 	}
308 308
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @param int $action_id Action ID.
313 313
 	 */
314
-	public function log_execution( $action_id ) {
315
-		$store = $this->get_store_from_action_id( $action_id );
316
-		if ( $store ) {
317
-			$store->log_execution( $action_id );
314
+	public function log_execution($action_id) {
315
+		$store = $this->get_store_from_action_id($action_id);
316
+		if ($store) {
317
+			$store->log_execution($action_id);
318 318
 		}
319 319
 	}
320 320
 
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 	 *
324 324
 	 * @param int $action_id Action ID.
325 325
 	 */
326
-	public function mark_complete( $action_id ) {
327
-		$store = $this->get_store_from_action_id( $action_id );
328
-		if ( $store ) {
329
-			$store->mark_complete( $action_id );
326
+	public function mark_complete($action_id) {
327
+		$store = $this->get_store_from_action_id($action_id);
328
+		if ($store) {
329
+			$store->mark_complete($action_id);
330 330
 		}
331 331
 	}
332 332
 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	 *
336 336
 	 * @param int $action_id Action ID.
337 337
 	 */
338
-	public function get_status( $action_id ) {
339
-		$store = $this->get_store_from_action_id( $action_id );
340
-		if ( $store ) {
341
-			return $store->get_status( $action_id );
338
+	public function get_status($action_id) {
339
+		$store = $this->get_store_from_action_id($action_id);
340
+		if ($store) {
341
+			return $store->get_status($action_id);
342 342
 		}
343 343
 		return null;
344 344
 	}
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
 	 * @param bool $primary_first Optional flag indicating search the primary store first.
351 351
 	 * @return ActionScheduler_Store
352 352
 	 */
353
-	protected function get_store_from_action_id( $action_id, $primary_first = false ) {
354
-		if ( $primary_first ) {
353
+	protected function get_store_from_action_id($action_id, $primary_first = false) {
354
+		if ($primary_first) {
355 355
 			$stores = [
356 356
 				$this->primary_store,
357 357
 				$this->secondary_store,
358 358
 			];
359
-		} elseif ( $action_id < $this->demarkation_id ) {
359
+		} elseif ($action_id < $this->demarkation_id) {
360 360
 			$stores = [
361 361
 				$this->secondary_store,
362 362
 				$this->primary_store,
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 			];
368 368
 		}
369 369
 
370
-		foreach ( $stores as $store ) {
371
-			$action = $store->fetch_action( $action_id );
372
-			if ( ! is_a( $action, 'ActionScheduler_NullAction' ) ) {
370
+		foreach ($stores as $store) {
371
+			$action = $store->fetch_action($action_id);
372
+			if (!is_a($action, 'ActionScheduler_NullAction')) {
373 373
 				return $store;
374 374
 			}
375 375
 		}
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @param int $action_id Action ID.
395 395
 	 */
396
-	public function get_claim_id( $action_id ) {
397
-		return $this->primary_store->get_claim_id( $action_id );
396
+	public function get_claim_id($action_id) {
397
+		return $this->primary_store->get_claim_id($action_id);
398 398
 	}
399 399
 
400 400
 	/**
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	 *
403 403
 	 * @param ActionScheduler_ActionClaim $claim Claim object.
404 404
 	 */
405
-	public function release_claim( ActionScheduler_ActionClaim $claim ) {
406
-		$this->primary_store->release_claim( $claim );
405
+	public function release_claim(ActionScheduler_ActionClaim $claim) {
406
+		$this->primary_store->release_claim($claim);
407 407
 	}
408 408
 
409 409
 	/**
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @param int $action_id Action ID.
413 413
 	 */
414
-	public function unclaim_action( $action_id ) {
415
-		$this->primary_store->unclaim_action( $action_id );
414
+	public function unclaim_action($action_id) {
415
+		$this->primary_store->unclaim_action($action_id);
416 416
 	}
417 417
 
418 418
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @param int $claim_id Claim ID.
422 422
 	 */
423
-	public function find_actions_by_claim_id( $claim_id ) {
424
-		return $this->primary_store->find_actions_by_claim_id( $claim_id );
423
+	public function find_actions_by_claim_id($claim_id) {
424
+		return $this->primary_store->find_actions_by_claim_id($claim_id);
425 425
 	}
426 426
 }
Please login to merge, or discard this patch.