Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
action-scheduler/classes/ActionScheduler_InvalidActionException.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	 * @param string $action_id The action ID with bad args.
16 16
 	 * @return static
17 17
 	 */
18
-	public static function from_schedule( $action_id, $schedule ) {
18
+	public static function from_schedule($action_id, $schedule) {
19 19
 		$message = sprintf(
20 20
 			/* translators: 1: action ID 2: schedule */
21
-			__( 'Action [%1$s] has an invalid schedule: %2$s', 'woocommerce' ),
21
+			__('Action [%1$s] has an invalid schedule: %2$s', 'woocommerce'),
22 22
 			$action_id,
23
-			var_export( $schedule, true )
23
+			var_export($schedule, true)
24 24
 		);
25 25
 
26
-		return new static( $message );
26
+		return new static($message);
27 27
 	}
28 28
 
29 29
 	/**
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 	 * @param string $action_id The action ID with bad args.
35 35
 	 * @return static
36 36
 	 */
37
-	public static function from_decoding_args( $action_id, $args = array() ) {
37
+	public static function from_decoding_args($action_id, $args = array()) {
38 38
 		$message = sprintf(
39 39
 			/* translators: 1: action ID 2: arguments */
40
-			__( 'Action [%1$s] has invalid arguments. It cannot be JSON decoded to an array. $args = %2$s', 'woocommerce' ),
40
+			__('Action [%1$s] has invalid arguments. It cannot be JSON decoded to an array. $args = %2$s', 'woocommerce'),
41 41
 			$action_id,
42
-			var_export( $args, true )
42
+			var_export($args, true)
43 43
 		);
44 44
 
45
-		return new static( $message );
45
+		return new static($message);
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
packages/action-scheduler/classes/schedules/ActionScheduler_Schedule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 	 * @param DateTime $after
9 9
 	 * @return DateTime|null
10 10
 	 */
11
-	public function next( DateTime $after = NULL );
11
+	public function next(DateTime $after = NULL);
12 12
 
13 13
 	/**
14 14
 	 * @return bool
Please login to merge, or discard this patch.
action-scheduler/classes/schedules/ActionScheduler_IntervalSchedule.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	 * @param DateTime $after
23 23
 	 * @return DateTime
24 24
 	 */
25
-	protected function calculate_next( DateTime $after ) {
26
-		$after->modify( '+' . (int) $this->get_recurrence() . ' seconds' );
25
+	protected function calculate_next(DateTime $after) {
26
+		$after->modify('+' . (int) $this->get_recurrence() . ' seconds');
27 27
 		return $after;
28 28
 	}
29 29
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return int
32 32
 	 */
33 33
 	public function interval_in_seconds() {
34
-		_deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' );
34
+		_deprecated_function(__METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()');
35 35
 		return (int) $this->get_recurrence();
36 36
 	}
37 37
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 		$this->start_timestamp     = $this->scheduled_timestamp;
56 56
 		$this->interval_in_seconds = $this->recurrence;
57 57
 
58
-		return array_merge( $sleep_params, array(
58
+		return array_merge($sleep_params, array(
59 59
 			'start_timestamp',
60 60
 			'interval_in_seconds'
61
-		) );
61
+		));
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	 * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
68 68
 	 */
69 69
 	public function __wakeup() {
70
-		if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
70
+		if (is_null($this->scheduled_timestamp) && !is_null($this->start_timestamp)) {
71 71
 			$this->scheduled_timestamp = $this->start_timestamp;
72
-			unset( $this->start_timestamp );
72
+			unset($this->start_timestamp);
73 73
 		}
74 74
 
75
-		if ( is_null( $this->recurrence ) && ! is_null( $this->interval_in_seconds ) ) {
75
+		if (is_null($this->recurrence) && !is_null($this->interval_in_seconds)) {
76 76
 			$this->recurrence = $this->interval_in_seconds;
77
-			unset( $this->interval_in_seconds );
77
+			unset($this->interval_in_seconds);
78 78
 		}
79 79
 		parent::__wakeup();
80 80
 	}
Please login to merge, or discard this patch.
action-scheduler/classes/schedules/ActionScheduler_CronSchedule.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 	 * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance.
24 24
 	 * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance.
25 25
 	 */
26
-	public function __construct( DateTime $start, $recurrence, DateTime $first = null ) {
27
-		if ( ! is_a( $recurrence, 'CronExpression' ) ) {
28
-			$recurrence = CronExpression::factory( $recurrence );
26
+	public function __construct(DateTime $start, $recurrence, DateTime $first = null) {
27
+		if (!is_a($recurrence, 'CronExpression')) {
28
+			$recurrence = CronExpression::factory($recurrence);
29 29
 		}
30 30
 
31 31
 		// For backward compatibility, we need to make sure the date is set to the first matching cron date, not whatever date is passed in. Importantly, by passing true as the 3rd param, if $start matches the cron expression, then it will be used. This was previously handled in the now deprecated next() method.
32
-		$date = $recurrence->getNextRunDate( $start, 0, true );
32
+		$date = $recurrence->getNextRunDate($start, 0, true);
33 33
 
34 34
 		// parent::__construct() will set this to $date by default, but that may be different to $start now.
35
-		$first = empty( $first ) ? $start : $first;
35
+		$first = empty($first) ? $start : $first;
36 36
 
37
-		parent::__construct( $date, $recurrence, $first );
37
+		parent::__construct($date, $recurrence, $first);
38 38
 	}
39 39
 
40 40
 	/**
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
 	 * @param DateTime $after
45 45
 	 * @return DateTime
46 46
 	 */
47
-	protected function calculate_next( DateTime $after ) {
48
-		return $this->recurrence->getNextRunDate( $after, 0, false );
47
+	protected function calculate_next(DateTime $after) {
48
+		return $this->recurrence->getNextRunDate($after, 0, false);
49 49
 	}
50 50
 
51 51
 	/**
52 52
 	 * @return string
53 53
 	 */
54 54
 	public function get_recurrence() {
55
-		return strval( $this->recurrence );
55
+		return strval($this->recurrence);
56 56
 	}
57 57
 
58 58
 	/**
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 		$this->start_timestamp = $this->scheduled_timestamp;
76 76
 		$this->cron            = $this->recurrence;
77 77
 
78
-		return array_merge( $sleep_params, array(
78
+		return array_merge($sleep_params, array(
79 79
 			'start_timestamp',
80 80
 			'cron'
81
-		) );
81
+		));
82 82
 	}
83 83
 
84 84
 	/**
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 	 * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
88 88
 	 */
89 89
 	public function __wakeup() {
90
-		if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
90
+		if (is_null($this->scheduled_timestamp) && !is_null($this->start_timestamp)) {
91 91
 			$this->scheduled_timestamp = $this->start_timestamp;
92
-			unset( $this->start_timestamp );
92
+			unset($this->start_timestamp);
93 93
 		}
94 94
 
95
-		if ( is_null( $this->recurrence ) && ! is_null( $this->cron ) ) {
95
+		if (is_null($this->recurrence) && !is_null($this->cron)) {
96 96
 			$this->recurrence = $this->cron;
97
-			unset( $this->cron );
97
+			unset($this->cron);
98 98
 		}
99 99
 		parent::__wakeup();
100 100
 	}
Please login to merge, or discard this patch.
action-scheduler/classes/schedules/ActionScheduler_CanceledSchedule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return DateTime|null
17 17
 	 */
18
-	public function calculate_next( DateTime $after ) {
18
+	public function calculate_next(DateTime $after) {
19 19
 		return null;
20 20
 	}
21 21
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param DateTime $after
27 27
 	 * @return DateTime|null
28 28
 	 */
29
-	public function get_next( DateTime $after ) {
29
+	public function get_next(DateTime $after) {
30 30
 		return null;
31 31
 	}
32 32
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * map the old property names with matching visibility.
49 49
 	 */
50 50
 	public function __wakeup() {
51
-		if ( ! is_null( $this->timestamp ) ) {
51
+		if (!is_null($this->timestamp)) {
52 52
 			$this->scheduled_timestamp = $this->timestamp;
53
-			unset( $this->timestamp );
53
+			unset($this->timestamp);
54 54
 		}
55 55
 		parent::__wakeup();
56 56
 	}
Please login to merge, or discard this patch.
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.
action-scheduler/classes/schedules/ActionScheduler_SimpleSchedule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return DateTime|null
17 17
 	 */
18
-	public function calculate_next( DateTime $after ) {
18
+	public function calculate_next(DateTime $after) {
19 19
 		return null;
20 20
 	}
21 21
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
 		$this->timestamp = $this->scheduled_timestamp;
47 47
 
48
-		return array_merge( $sleep_params, array(
48
+		return array_merge($sleep_params, array(
49 49
 			'timestamp',
50
-		) );
50
+		));
51 51
 	}
52 52
 
53 53
 	/**
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function __wakeup() {
64 64
 
65
-		if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->timestamp ) ) {
65
+		if (is_null($this->scheduled_timestamp) && !is_null($this->timestamp)) {
66 66
 			$this->scheduled_timestamp = $this->timestamp;
67
-			unset( $this->timestamp );
67
+			unset($this->timestamp);
68 68
 		}
69 69
 		parent::__wakeup();
70 70
 	}
Please login to merge, or discard this patch.
plugins/woocommerce/packages/action-scheduler/lib/WP_Async_Request.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 License URI: https://github.com/deliciousbrains/wp-background-processing/commit/126d7945dd3d39f39cb6488ca08fe1fb66cb351a
13 13
 */
14 14
 
15
-if ( ! class_exists( 'WP_Async_Request' ) ) {
15
+if (!class_exists('WP_Async_Request')) {
16 16
 
17 17
 	/**
18 18
 	 * Abstract WP_Async_Request class.
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 		public function __construct() {
66 66
 			$this->identifier = $this->prefix . '_' . $this->action;
67 67
 
68
-			add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
69
-			add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
68
+			add_action('wp_ajax_' . $this->identifier, array($this, 'maybe_handle'));
69
+			add_action('wp_ajax_nopriv_' . $this->identifier, array($this, 'maybe_handle'));
70 70
 		}
71 71
 
72 72
 		/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		 *
77 77
 		 * @return $this
78 78
 		 */
79
-		public function data( $data ) {
79
+		public function data($data) {
80 80
 			$this->data = $data;
81 81
 
82 82
 			return $this;
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 		 * @return array|WP_Error
89 89
 		 */
90 90
 		public function dispatch() {
91
-			$url  = add_query_arg( $this->get_query_args(), $this->get_query_url() );
91
+			$url  = add_query_arg($this->get_query_args(), $this->get_query_url());
92 92
 			$args = $this->get_post_args();
93 93
 
94
-			return wp_remote_post( esc_url_raw( $url ), $args );
94
+			return wp_remote_post(esc_url_raw($url), $args);
95 95
 		}
96 96
 
97 97
 		/**
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 		 * @return array
101 101
 		 */
102 102
 		protected function get_query_args() {
103
-			if ( property_exists( $this, 'query_args' ) ) {
103
+			if (property_exists($this, 'query_args')) {
104 104
 				return $this->query_args;
105 105
 			}
106 106
 
107 107
 			$args = array(
108 108
 				'action' => $this->identifier,
109
-				'nonce'  => wp_create_nonce( $this->identifier ),
109
+				'nonce'  => wp_create_nonce($this->identifier),
110 110
 			);
111 111
 
112 112
 			/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			 *
115 115
 			 * @param array $url
116 116
 			 */
117
-			return apply_filters( $this->identifier . '_query_args', $args );
117
+			return apply_filters($this->identifier . '_query_args', $args);
118 118
 		}
119 119
 
120 120
 		/**
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
 		 * @return string
124 124
 		 */
125 125
 		protected function get_query_url() {
126
-			if ( property_exists( $this, 'query_url' ) ) {
126
+			if (property_exists($this, 'query_url')) {
127 127
 				return $this->query_url;
128 128
 			}
129 129
 
130
-			$url = admin_url( 'admin-ajax.php' );
130
+			$url = admin_url('admin-ajax.php');
131 131
 
132 132
 			/**
133 133
 			 * Filters the post arguments used during an async request.
134 134
 			 *
135 135
 			 * @param string $url
136 136
 			 */
137
-			return apply_filters( $this->identifier . '_query_url', $url );
137
+			return apply_filters($this->identifier . '_query_url', $url);
138 138
 		}
139 139
 
140 140
 		/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @return array
144 144
 		 */
145 145
 		protected function get_post_args() {
146
-			if ( property_exists( $this, 'post_args' ) ) {
146
+			if (property_exists($this, 'post_args')) {
147 147
 				return $this->post_args;
148 148
 			}
149 149
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 				'blocking'  => false,
153 153
 				'body'      => $this->data,
154 154
 				'cookies'   => $_COOKIE,
155
-				'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
155
+				'sslverify' => apply_filters('https_local_ssl_verify', false),
156 156
 			);
157 157
 
158 158
 			/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			 *
161 161
 			 * @param array $args
162 162
 			 */
163
-			return apply_filters( $this->identifier . '_post_args', $args );
163
+			return apply_filters($this->identifier . '_post_args', $args);
164 164
 		}
165 165
 
166 166
 		/**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			// Don't lock up other requests while processing
173 173
 			session_write_close();
174 174
 
175
-			check_ajax_referer( $this->identifier, 'nonce' );
175
+			check_ajax_referer($this->identifier, 'nonce');
176 176
 
177 177
 			$this->handle();
178 178
 
Please login to merge, or discard this patch.
action-scheduler/lib/cron-expression/CronExpression_AbstractField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
             return false;
90 90
         }
91 91
 
92
-        for ($i = $offset; $i <= $to; $i+= $stepSize) {
92
+        for ($i = $offset; $i <= $to; $i += $stepSize) {
93 93
             if ($i == $dateValue) {
94 94
                 return true;
95 95
             }
Please login to merge, or discard this patch.