Passed
Pull Request — master (#195)
by Jonathan
02:48
created
classes/class-object-sync-sf-queue.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Object Sync for Salesforce Queue
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit; // Exit if accessed directly.
8 8
 }
9 9
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	protected $slug;
21 21
 	protected $schedulable_classes;
22 22
 
23
-	public function __construct( $wpdb, $version, $slug, $schedulable_classes ) {
23
+	public function __construct($wpdb, $version, $slug, $schedulable_classes) {
24 24
 		$this->wpdb                = $wpdb;
25 25
 		$this->version             = $version;
26 26
 		$this->slug                = $slug;
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 */
36 36
 	private function add_actions() {
37
-		add_filter( 'action_scheduler_queue_runner_batch_size', array( $this, 'action_scheduler_batch_size' ) );
38
-		add_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'action_scheduler_concurrent_batches' ) );
37
+		add_filter('action_scheduler_queue_runner_batch_size', array($this, 'action_scheduler_batch_size'));
38
+		add_filter('action_scheduler_queue_runner_concurrent_batches', array($this, 'action_scheduler_concurrent_batches'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param int  $batch_size
45 45
 	 * @return int  $batch_size
46 46
 	 */
47
-	public function action_scheduler_batch_size( $batch_size ) {
47
+	public function action_scheduler_batch_size($batch_size) {
48 48
 		return 10;
49 49
 	}
50 50
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param int  $concurrent_batches
55 55
 	 * @return int  $concurrent_batches
56 56
 	 */
57
-	public function action_scheduler_concurrent_batches( $concurrent_batches ) {
57
+	public function action_scheduler_concurrent_batches($concurrent_batches) {
58 58
 		return 5;
59 59
 	}
60 60
 
@@ -65,25 +65,25 @@  discard block
 block discarded – undo
65 65
 	 * @param string  $sort Which direction to sort
66 66
 	 * @return array $this->schedulable_classes
67 67
 	 */
68
-	public function get_frequencies( $unit = 'seconds', $sort = 'asc' ) {
68
+	public function get_frequencies($unit = 'seconds', $sort = 'asc') {
69 69
 
70
-		foreach ( $this->schedulable_classes as $key => $schedule ) {
71
-			$this->schedulable_classes[ $key ]['frequency'] = $this->get_frequency( $key, 'seconds' );
70
+		foreach ($this->schedulable_classes as $key => $schedule) {
71
+			$this->schedulable_classes[$key]['frequency'] = $this->get_frequency($key, 'seconds');
72 72
 		}
73 73
 
74
-		if ( 'asc' === $sort ) {
75
-			uasort( $this->schedulable_classes, function( $a, $b ) {
74
+		if ('asc' === $sort) {
75
+			uasort($this->schedulable_classes, function($a, $b) {
76 76
 				// we want zero values at the top of an ascending sort
77
-				if ( 0 === $a ) {
77
+				if (0 === $a) {
78 78
 					return 1;
79 79
 				}
80
-				if ( 0 === $b ) {
80
+				if (0 === $b) {
81 81
 					return -1;
82 82
 				}
83 83
 				return $a['frequency'] - $b['frequency'];
84 84
 			});
85 85
 		} else {
86
-			uasort( $this->schedulable_classes, function( $a, $b ) {
86
+			uasort($this->schedulable_classes, function($a, $b) {
87 87
 				return $b['frequency'] - $a['frequency'];
88 88
 			});
89 89
 		}
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 * @param string  $unit The unit of time
100 100
 	 * @return int How often it runs in that unit of time
101 101
 	 */
102
-	public function get_frequency( $name, $unit ) {
103
-		$schedule_number = filter_var( get_option( 'object_sync_for_salesforce_' . $name . '_schedule_number', '' ), FILTER_VALIDATE_INT );
104
-		$schedule_unit   = get_option( 'object_sync_for_salesforce_' . $name . '_schedule_unit', '' );
102
+	public function get_frequency($name, $unit) {
103
+		$schedule_number = filter_var(get_option('object_sync_for_salesforce_' . $name . '_schedule_number', ''), FILTER_VALIDATE_INT);
104
+		$schedule_unit   = get_option('object_sync_for_salesforce_' . $name . '_schedule_unit', '');
105 105
 
106
-		switch ( $schedule_unit ) {
106
+		switch ($schedule_unit) {
107 107
 			case 'minutes':
108 108
 				$seconds = 60;
109 109
 				$minutes = 1;
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @param string $group The group to assign this job to.
135 135
 	 * @return string The action ID.
136 136
 	 */
137
-	public function add( $hook, $args = array(), $group = '' ) {
138
-		return $this->schedule_single( time(), $hook, $args, $group );
137
+	public function add($hook, $args = array(), $group = '') {
138
+		return $this->schedule_single(time(), $hook, $args, $group);
139 139
 	}
140 140
 
141 141
 	/**
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param string $group The group to assign this job to.
148 148
 	 * @return string The action ID.
149 149
 	 */
150
-	public function schedule_single( $timestamp, $hook, $args = array(), $group = '' ) {
151
-		return as_schedule_single_action( $timestamp, $hook, $args, $group );
150
+	public function schedule_single($timestamp, $hook, $args = array(), $group = '') {
151
+		return as_schedule_single_action($timestamp, $hook, $args, $group);
152 152
 	}
153 153
 
154 154
 	/**
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @param string $group The group to assign this job to.
162 162
 	 * @return string The action ID.
163 163
 	 */
164
-	public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) {
165
-		return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group );
164
+	public function schedule_recurring($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') {
165
+		return as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args, $group);
166 166
 	}
167 167
 
168 168
 	/**
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param string $group The group to assign this job to.
186 186
 	 * @return string The action ID
187 187
 	 */
188
-	public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' ) {
189
-		return as_schedule_cron_action( $timestamp, $cron_schedule, $hook, $args, $group );
188
+	public function schedule_cron($timestamp, $cron_schedule, $hook, $args = array(), $group = '') {
189
+		return as_schedule_cron_action($timestamp, $cron_schedule, $hook, $args, $group);
190 190
 	}
191 191
 
192 192
 	/**
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	 * @param array  $args Args that would have been passed to the job.
203 203
 	 * @param string $group Group name.
204 204
 	 */
205
-	public function cancel( $hook, $args = array(), $group = '' ) {
206
-		as_unschedule_action( $hook, $args, $group );
205
+	public function cancel($hook, $args = array(), $group = '') {
206
+		as_unschedule_action($hook, $args, $group);
207 207
 	}
208 208
 
209 209
 	/**
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 	 * @param string $group Group name.
216 216
 	 * @return time|null The date and time for the next occurrence, or null if there is no pending, scheduled action for the given hook.
217 217
 	 */
218
-	public function get_next( $hook, $args = null, $group = '' ) {
218
+	public function get_next($hook, $args = null, $group = '') {
219 219
 
220
-		$next_timestamp = as_next_scheduled_action( $hook, $args, $group );
220
+		$next_timestamp = as_next_scheduled_action($hook, $args, $group);
221 221
 
222
-		if ( $next_timestamp ) {
222
+		if ($next_timestamp) {
223 223
 			return $next_timestamp;
224 224
 		}
225 225
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * @param string $return_format OBJECT, ARRAY_A, or ids.
248 248
 	 * @return array
249 249
 	 */
250
-	public function search( $args = array(), $return_format = OBJECT ) {
251
-		return as_get_scheduled_actions( $args, $return_format );
250
+	public function search($args = array(), $return_format = OBJECT) {
251
+		return as_get_scheduled_actions($args, $return_format);
252 252
 	}
253 253
 }
Please login to merge, or discard this patch.