Completed
Pull Request — develop (#1630)
by
unknown
01:13
created
src/ext/action-scheduler/deprecated/ActionScheduler_Store_Deprecated.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 	 *
14 14
 	 * @param int $action_id The ID of the action.
15 15
 	 */
16
-	public function mark_failed_fetch_action( $action_id ) {
17
-		_deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' );
18
-		self::$store->mark_failure( $action_id );
16
+	public function mark_failed_fetch_action($action_id) {
17
+		_deprecated_function(__METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()');
18
+		self::$store->mark_failure($action_id);
19 19
 	}
20 20
 
21 21
 	/**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @since 2.2.6
25 25
 	 */
26 26
 	protected static function hook() {
27
-		_deprecated_function( __METHOD__, '3.0.0' );
27
+		_deprecated_function(__METHOD__, '3.0.0');
28 28
 	}
29 29
 
30 30
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @since 2.2.6
34 34
 	 */
35 35
 	protected static function unhook() {
36
-		_deprecated_function( __METHOD__, '3.0.0' );
36
+		_deprecated_function(__METHOD__, '3.0.0');
37 37
 	}
38 38
 
39 39
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return DateTimeZone
44 44
 	 */
45 45
 	protected function get_local_timezone() {
46
-		_deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' );
46
+		_deprecated_function(__FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()');
47 47
 		return ActionScheduler_TimezoneHelper::get_local_timezone();
48 48
 	}
49 49
 }
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', 'action-scheduler' ),
36
+			'label'       => _x('Failed', 'post', 'action-scheduler'),
37 37
 			/* translators: %s: count */
38
-			'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'action-scheduler' ),
38
+			'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'action-scheduler'),
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', 'action-scheduler' ),
51
+			'label'       => _x('In-Progress', 'post', 'action-scheduler'),
52 52
 			/* translators: %s: count */
53
-			'label_count' => _n_noop( 'In-Progress <span class="count">(%s)</span>', 'In-Progress <span class="count">(%s)</span>', 'action-scheduler' ),
53
+			'label_count' => _n_noop('In-Progress <span class="count">(%s)</span>', 'In-Progress <span class="count">(%s)</span>', 'action-scheduler'),
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.
src/ext/action-scheduler/classes/schedules/ActionScheduler_NullSchedule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	 *
11 11
 	 * @param null $date The date & time to run the action.
12 12
 	 */
13
-	public function __construct( DateTime $date = null ) {
13
+	public function __construct(DateTime $date = null) {
14 14
 		$this->scheduled_date = null;
15 15
 	}
16 16
 
Please login to merge, or discard this patch.
src/ext/action-scheduler/classes/migration/DryRun_ActionMigrator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@
 block discarded – undo
20 20
 	 *
21 21
 	 * @return int
22 22
 	 */
23
-	public function migrate( $source_action_id ) {
24
-		do_action( 'action_scheduler/migrate_action_dry_run', $source_action_id );
23
+	public function migrate($source_action_id) {
24
+		do_action('action_scheduler/migrate_action_dry_run', $source_action_id);
25 25
 
26 26
 		return 0;
27 27
 	}
Please login to merge, or discard this patch.
src/ext/action-scheduler/classes/migration/Controller.php 1 patch
Spacing   +31 added lines, -31 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 {
@@ -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.', 'action-scheduler' ) );
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.', 'action-scheduler'));
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.
src/ext/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.
src/ext/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', 'action-scheduler' ) );
51
+		if (empty($this->source_store)) {
52
+			throw new \RuntimeException(__('Source store must be configured before running a migration', 'action-scheduler'));
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', 'action-scheduler' ) );
73
+		if (empty($this->source_logger)) {
74
+			throw new \RuntimeException(__('Source logger must be configured before running a migration', 'action-scheduler'));
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', 'action-scheduler' ) );
95
+		if (empty($this->destination_store)) {
96
+			throw new \RuntimeException(__('Destination store must be configured before running a migration', 'action-scheduler'));
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', 'action-scheduler' ) );
117
+		if (empty($this->destination_logger)) {
118
+			throw new \RuntimeException(__('Destination logger must be configured before running a migration', 'action-scheduler'));
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.
src/ext/action-scheduler/classes/migration/Scheduler.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 	 * Set up the callback for the scheduled job.
24 24
 	 */
25 25
 	public function hook() {
26
-		add_action( self::HOOK, array( $this, 'run_migration' ), 10, 0 );
26
+		add_action(self::HOOK, array($this, 'run_migration'), 10, 0);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * Remove the callback for the scheduled job.
31 31
 	 */
32 32
 	public function unhook() {
33
-		remove_action( self::HOOK, array( $this, 'run_migration' ), 10 );
33
+		remove_action(self::HOOK, array($this, 'run_migration'), 10);
34 34
 	}
35 35
 
36 36
 	/**
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function run_migration() {
40 40
 		$migration_runner = $this->get_migration_runner();
41
-		$count            = $migration_runner->run( $this->get_batch_size() );
41
+		$count            = $migration_runner->run($this->get_batch_size());
42 42
 
43
-		if ( $count === 0 ) {
43
+		if ($count === 0) {
44 44
 			$this->mark_complete();
45 45
 		} else {
46
-			$this->schedule_migration( time() + $this->get_schedule_interval() );
46
+			$this->schedule_migration(time() + $this->get_schedule_interval());
47 47
 		}
48 48
 	}
49 49
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->unschedule_migration();
55 55
 
56 56
 		\ActionScheduler_DataController::mark_migration_complete();
57
-		do_action( 'action_scheduler/migration_complete' );
57
+		do_action('action_scheduler/migration_complete');
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 * @return bool Whether there is a pending action in the store to handle the migration
64 64
 	 */
65 65
 	public function is_migration_scheduled() {
66
-		$next = as_next_scheduled_action( self::HOOK );
66
+		$next = as_next_scheduled_action(self::HOOK);
67 67
 
68
-		return ! empty( $next );
68
+		return ! empty($next);
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return string The action ID
77 77
 	 */
78
-	public function schedule_migration( $when = 0 ) {
79
-		$next = as_next_scheduled_action( self::HOOK );
78
+	public function schedule_migration($when = 0) {
79
+		$next = as_next_scheduled_action(self::HOOK);
80 80
 
81
-		if ( ! empty( $next ) ) {
81
+		if ( ! empty($next)) {
82 82
 			return $next;
83 83
 		}
84 84
 
85
-		if ( empty( $when ) ) {
85
+		if (empty($when)) {
86 86
 			$when = time() + MINUTE_IN_SECONDS;
87 87
 		}
88 88
 
89
-		return as_schedule_single_action( $when, self::HOOK, array(), self::GROUP );
89
+		return as_schedule_single_action($when, self::HOOK, array(), self::GROUP);
90 90
 	}
91 91
 
92 92
 	/**
93 93
 	 * Remove the scheduled migration action.
94 94
 	 */
95 95
 	public function unschedule_migration() {
96
-		as_unschedule_action( self::HOOK, null, self::GROUP );
96
+		as_unschedule_action(self::HOOK, null, self::GROUP);
97 97
 	}
98 98
 
99 99
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return int Seconds between migration runs. Defaults to 0 seconds to allow chaining migration via Async Runners.
103 103
 	 */
104 104
 	private function get_schedule_interval() {
105
-		return (int) apply_filters( 'action_scheduler/migration_interval', 0 );
105
+		return (int) apply_filters('action_scheduler/migration_interval', 0);
106 106
 	}
107 107
 
108 108
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return int Number of actions to migrate in each batch. Defaults to 250.
112 112
 	 */
113 113
 	private function get_batch_size() {
114
-		return (int) apply_filters( 'action_scheduler/migration_batch_size', 250 );
114
+		return (int) apply_filters('action_scheduler/migration_batch_size', 250);
115 115
 	}
116 116
 
117 117
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	private function get_migration_runner() {
123 123
 		$config = Controller::instance()->get_migration_config_object();
124 124
 
125
-		return new Runner( $config );
125
+		return new Runner($config);
126 126
 	}
127 127
 
128 128
 }
Please login to merge, or discard this patch.
src/ext/action-scheduler/classes/ActionScheduler_DataController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @return bool
45 45
 	 */
46 46
 	public static function dependencies_met() {
47
-		$php_support = version_compare( PHP_VERSION, self::MIN_PHP_VERSION, '>=' );
48
-		return $php_support && apply_filters( 'action_scheduler_migration_dependencies_met', true );
47
+		$php_support = version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '>=');
48
+		return $php_support && apply_filters('action_scheduler_migration_dependencies_met', true);
49 49
 	}
50 50
 
51 51
 	/**
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	 * @return bool Whether the flag has been set marking the migration as complete
55 55
 	 */
56 56
 	public static function is_migration_complete() {
57
-		return get_option( self::STATUS_FLAG ) === self::STATUS_COMPLETE;
57
+		return get_option(self::STATUS_FLAG) === self::STATUS_COMPLETE;
58 58
 	}
59 59
 
60 60
 	/**
61 61
 	 * Mark the migration as complete.
62 62
 	 */
63 63
 	public static function mark_migration_complete() {
64
-		update_option( self::STATUS_FLAG, self::STATUS_COMPLETE );
64
+		update_option(self::STATUS_FLAG, self::STATUS_COMPLETE);
65 65
 	}
66 66
 
67 67
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * deactivated and the site was running on AS 2.x again.
71 71
 	 */
72 72
 	public static function mark_migration_incomplete() {
73
-		delete_option( self::STATUS_FLAG );
73
+		delete_option(self::STATUS_FLAG);
74 74
 	}
75 75
 
76 76
 	/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return string
82 82
 	 */
83
-	public static function set_store_class( $class ) {
83
+	public static function set_store_class($class) {
84 84
 		return self::DATASTORE_CLASS;
85 85
 	}
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return string
93 93
 	 */
94
-	public static function set_logger_class( $class ) {
94
+	public static function set_logger_class($class) {
95 95
 		return self::LOGGER_CLASS;
96 96
 	}
97 97
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param integer $sleep_time The number of seconds to pause before resuming operation.
102 102
 	 */
103
-	public static function set_sleep_time( $sleep_time ) {
103
+	public static function set_sleep_time($sleep_time) {
104 104
 		self::$sleep_time = (int) $sleep_time;
105 105
 	}
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param integer $free_ticks The number of ticks to free memory on.
111 111
 	 */
112
-	public static function set_free_ticks( $free_ticks ) {
112
+	public static function set_free_ticks($free_ticks) {
113 113
 		self::$free_ticks = (int) $free_ticks;
114 114
 	}
115 115
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param int $ticks Current tick count.
120 120
 	 */
121
-	public static function maybe_free_memory( $ticks ) {
122
-		if ( self::$free_ticks && 0 === $ticks % self::$free_ticks ) {
121
+	public static function maybe_free_memory($ticks) {
122
+		if (self::$free_ticks && 0 === $ticks % self::$free_ticks) {
123 123
 			self::free_memory();
124 124
 		}
125 125
 	}
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 * Reduce memory footprint by clearing the database query and object caches.
129 129
 	 */
130 130
 	public static function free_memory() {
131
-		if ( 0 < self::$sleep_time ) {
131
+		if (0 < self::$sleep_time) {
132 132
 			/* translators: %d: amount of time */
133
-			\WP_CLI::warning( sprintf( _n( 'Stopped the insanity for %d second', 'Stopped the insanity for %d seconds', self::$sleep_time, 'action-scheduler' ), self::$sleep_time ) );
134
-			sleep( self::$sleep_time );
133
+			\WP_CLI::warning(sprintf(_n('Stopped the insanity for %d second', 'Stopped the insanity for %d seconds', self::$sleep_time, 'action-scheduler'), self::$sleep_time));
134
+			sleep(self::$sleep_time);
135 135
 		}
136 136
 
137
-		\WP_CLI::warning( __( 'Attempting to reduce used memory...', 'action-scheduler' ) );
137
+		\WP_CLI::warning(__('Attempting to reduce used memory...', 'action-scheduler'));
138 138
 
139 139
 		/**
140 140
 		 * @var $wpdb            \wpdb
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$wpdb->queries = array();
146 146
 
147
-		if ( ! is_a( $wp_object_cache, 'WP_Object_Cache' ) ) {
147
+		if ( ! is_a($wp_object_cache, 'WP_Object_Cache')) {
148 148
 			return;
149 149
 		}
150 150
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 		$wp_object_cache->memcache_debug = array();
154 154
 		$wp_object_cache->cache          = array();
155 155
 
156
-		if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) {
157
-			call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important
156
+		if (is_callable(array($wp_object_cache, '__remoteset'))) {
157
+			call_user_func(array($wp_object_cache, '__remoteset')); // important
158 158
 		}
159 159
 	}
160 160
 
@@ -163,22 +163,22 @@  discard block
 block discarded – undo
163 163
 	 * Otherwise, proceed with the migration if the dependencies have been met.
164 164
 	 */
165 165
 	public static function init() {
166
-		if ( self::is_migration_complete() ) {
167
-			add_filter( 'action_scheduler_store_class', array( 'ActionScheduler_DataController', 'set_store_class' ), 100 );
168
-			add_filter( 'action_scheduler_logger_class', array( 'ActionScheduler_DataController', 'set_logger_class' ), 100 );
169
-			add_action( 'deactivate_plugin', array( 'ActionScheduler_DataController', 'mark_migration_incomplete' ) );
170
-		} elseif ( self::dependencies_met() ) {
166
+		if (self::is_migration_complete()) {
167
+			add_filter('action_scheduler_store_class', array('ActionScheduler_DataController', 'set_store_class'), 100);
168
+			add_filter('action_scheduler_logger_class', array('ActionScheduler_DataController', 'set_logger_class'), 100);
169
+			add_action('deactivate_plugin', array('ActionScheduler_DataController', 'mark_migration_incomplete'));
170
+		} elseif (self::dependencies_met()) {
171 171
 			Controller::init();
172 172
 		}
173 173
 
174
-		add_action( 'action_scheduler/progress_tick', array( 'ActionScheduler_DataController', 'maybe_free_memory' ) );
174
+		add_action('action_scheduler/progress_tick', array('ActionScheduler_DataController', 'maybe_free_memory'));
175 175
 	}
176 176
 
177 177
 	/**
178 178
 	 * Singleton factory.
179 179
 	 */
180 180
 	public static function instance() {
181
-		if ( ! isset( self::$instance ) ) {
181
+		if ( ! isset(self::$instance)) {
182 182
 			self::$instance = new static();
183 183
 		}
184 184
 
Please login to merge, or discard this patch.