Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
woocommerce/packages/action-scheduler/classes/ActionScheduler_LogEntry.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_LogEntry {
7 7
 
8
-	/**
9
-	 * @var int $action_id
10
-	 */
11
-	protected $action_id =  '';
8
+    /**
9
+     * @var int $action_id
10
+     */
11
+    protected $action_id =  '';
12 12
 
13
-	/**
14
-	 * @var string $message
15
-	 */
16
-	protected $message =  '';
13
+    /**
14
+     * @var string $message
15
+     */
16
+    protected $message =  '';
17 17
 
18
-	/**
19
-	 * @var Datetime $date
20
-	 */
21
-	protected $date;
18
+    /**
19
+     * @var Datetime $date
20
+     */
21
+    protected $date;
22 22
 
23
-	/**
24
-	 * Constructor
25
-	 *
26
-	 * @param mixed  $action_id Action ID
27
-	 * @param string $message   Message
28
-	 * @param Datetime $date    Datetime object with the time when this log entry was created. If this parameter is
29
-	 *                          not provided a new Datetime object (with current time) will be created.
30
-	 */
31
-	public function __construct( $action_id, $message, $date = null ) {
23
+    /**
24
+     * Constructor
25
+     *
26
+     * @param mixed  $action_id Action ID
27
+     * @param string $message   Message
28
+     * @param Datetime $date    Datetime object with the time when this log entry was created. If this parameter is
29
+     *                          not provided a new Datetime object (with current time) will be created.
30
+     */
31
+    public function __construct( $action_id, $message, $date = null ) {
32 32
 
33
-		/*
33
+        /*
34 34
 		 * ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type
35 35
 		 * to ActionScheduler_LogEntry::__construct(), goodness knows why, and the Follow-up Emails plugin
36 36
 		 * hard-codes loading its own version of ActionScheduler_wpCommentLogger with that out-dated method,
37 37
 		 * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration
38 38
 		 * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE.
39 39
 		 */
40
-		if ( null !== $date && ! is_a( $date, 'DateTime' ) ) {
41
-			_doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' );
42
-			$date = null;
43
-		}
40
+        if ( null !== $date && ! is_a( $date, 'DateTime' ) ) {
41
+            _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' );
42
+            $date = null;
43
+        }
44 44
 
45
-		$this->action_id = $action_id;
46
-		$this->message   = $message;
47
-		$this->date      = $date ? $date : new Datetime;
48
-	}
45
+        $this->action_id = $action_id;
46
+        $this->message   = $message;
47
+        $this->date      = $date ? $date : new Datetime;
48
+    }
49 49
 
50
-	/**
51
-	 * Returns the date when this log entry was created
52
-	 *
53
-	 * @return Datetime
54
-	 */
55
-	public function get_date() {
56
-		return $this->date;
57
-	}
50
+    /**
51
+     * Returns the date when this log entry was created
52
+     *
53
+     * @return Datetime
54
+     */
55
+    public function get_date() {
56
+        return $this->date;
57
+    }
58 58
 
59
-	public function get_action_id() {
60
-		return $this->action_id;
61
-	}
59
+    public function get_action_id() {
60
+        return $this->action_id;
61
+    }
62 62
 
63
-	public function get_message() {
64
-		return $this->message;
65
-	}
63
+    public function get_message() {
64
+        return $this->message;
65
+    }
66 66
 }
67 67
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 	/**
9 9
 	 * @var int $action_id
10 10
 	 */
11
-	protected $action_id =  '';
11
+	protected $action_id = '';
12 12
 
13 13
 	/**
14 14
 	 * @var string $message
15 15
 	 */
16
-	protected $message =  '';
16
+	protected $message = '';
17 17
 
18 18
 	/**
19 19
 	 * @var Datetime $date
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param Datetime $date    Datetime object with the time when this log entry was created. If this parameter is
29 29
 	 *                          not provided a new Datetime object (with current time) will be created.
30 30
 	 */
31
-	public function __construct( $action_id, $message, $date = null ) {
31
+	public function __construct($action_id, $message, $date = null) {
32 32
 
33 33
 		/*
34 34
 		 * ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 		 * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration
38 38
 		 * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE.
39 39
 		 */
40
-		if ( null !== $date && ! is_a( $date, 'DateTime' ) ) {
41
-			_doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' );
40
+		if (null !== $date && !is_a($date, 'DateTime')) {
41
+			_doing_it_wrong(__METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0');
42 42
 			$date = null;
43 43
 		}
44 44
 
Please login to merge, or discard this patch.
woocommerce/packages/action-scheduler/classes/ActionScheduler_DateTime.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -7,73 +7,73 @@
 block discarded – undo
7 7
  */
8 8
 class ActionScheduler_DateTime extends DateTime {
9 9
 
10
-	/**
11
-	 * UTC offset.
12
-	 *
13
-	 * Only used when a timezone is not set. When a timezone string is
14
-	 * used, this will be set to 0.
15
-	 *
16
-	 * @var int
17
-	 */
18
-	protected $utcOffset = 0;
10
+    /**
11
+     * UTC offset.
12
+     *
13
+     * Only used when a timezone is not set. When a timezone string is
14
+     * used, this will be set to 0.
15
+     *
16
+     * @var int
17
+     */
18
+    protected $utcOffset = 0;
19 19
 
20
-	/**
21
-	 * Get the unix timestamp of the current object.
22
-	 *
23
-	 * Missing in PHP 5.2 so just here so it can be supported consistently.
24
-	 *
25
-	 * @return int
26
-	 */
27
-	#[\ReturnTypeWillChange]
28
-	public function getTimestamp() {
29
-		return method_exists( 'DateTime', 'getTimestamp' ) ? parent::getTimestamp() : $this->format( 'U' );
30
-	}
20
+    /**
21
+     * Get the unix timestamp of the current object.
22
+     *
23
+     * Missing in PHP 5.2 so just here so it can be supported consistently.
24
+     *
25
+     * @return int
26
+     */
27
+    #[\ReturnTypeWillChange]
28
+    public function getTimestamp() {
29
+        return method_exists( 'DateTime', 'getTimestamp' ) ? parent::getTimestamp() : $this->format( 'U' );
30
+    }
31 31
 
32
-	/**
33
-	 * Set the UTC offset.
34
-	 *
35
-	 * This represents a fixed offset instead of a timezone setting.
36
-	 *
37
-	 * @param $offset
38
-	 */
39
-	public function setUtcOffset( $offset ) {
40
-		$this->utcOffset = intval( $offset );
41
-	}
32
+    /**
33
+     * Set the UTC offset.
34
+     *
35
+     * This represents a fixed offset instead of a timezone setting.
36
+     *
37
+     * @param $offset
38
+     */
39
+    public function setUtcOffset( $offset ) {
40
+        $this->utcOffset = intval( $offset );
41
+    }
42 42
 
43
-	/**
44
-	 * Returns the timezone offset.
45
-	 *
46
-	 * @return int
47
-	 * @link http://php.net/manual/en/datetime.getoffset.php
48
-	 */
49
-	#[\ReturnTypeWillChange]
50
-	public function getOffset() {
51
-		return $this->utcOffset ? $this->utcOffset : parent::getOffset();
52
-	}
43
+    /**
44
+     * Returns the timezone offset.
45
+     *
46
+     * @return int
47
+     * @link http://php.net/manual/en/datetime.getoffset.php
48
+     */
49
+    #[\ReturnTypeWillChange]
50
+    public function getOffset() {
51
+        return $this->utcOffset ? $this->utcOffset : parent::getOffset();
52
+    }
53 53
 
54
-	/**
55
-	 * Set the TimeZone associated with the DateTime
56
-	 *
57
-	 * @param DateTimeZone $timezone
58
-	 *
59
-	 * @return static
60
-	 * @link http://php.net/manual/en/datetime.settimezone.php
61
-	 */
62
-	#[\ReturnTypeWillChange]
63
-	public function setTimezone( $timezone ) {
64
-		$this->utcOffset = 0;
65
-		parent::setTimezone( $timezone );
54
+    /**
55
+     * Set the TimeZone associated with the DateTime
56
+     *
57
+     * @param DateTimeZone $timezone
58
+     *
59
+     * @return static
60
+     * @link http://php.net/manual/en/datetime.settimezone.php
61
+     */
62
+    #[\ReturnTypeWillChange]
63
+    public function setTimezone( $timezone ) {
64
+        $this->utcOffset = 0;
65
+        parent::setTimezone( $timezone );
66 66
 
67
-		return $this;
68
-	}
67
+        return $this;
68
+    }
69 69
 
70
-	/**
71
-	 * Get the timestamp with the WordPress timezone offset added or subtracted.
72
-	 *
73
-	 * @since  3.0.0
74
-	 * @return int
75
-	 */
76
-	public function getOffsetTimestamp() {
77
-		return $this->getTimestamp() + $this->getOffset();
78
-	}
70
+    /**
71
+     * Get the timestamp with the WordPress timezone offset added or subtracted.
72
+     *
73
+     * @since  3.0.0
74
+     * @return int
75
+     */
76
+    public function getOffsetTimestamp() {
77
+        return $this->getTimestamp() + $this->getOffset();
78
+    }
79 79
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	#[\ReturnTypeWillChange]
28 28
 	public function getTimestamp() {
29
-		return method_exists( 'DateTime', 'getTimestamp' ) ? parent::getTimestamp() : $this->format( 'U' );
29
+		return method_exists('DateTime', 'getTimestamp') ? parent::getTimestamp() : $this->format('U');
30 30
 	}
31 31
 
32 32
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param $offset
38 38
 	 */
39
-	public function setUtcOffset( $offset ) {
40
-		$this->utcOffset = intval( $offset );
39
+	public function setUtcOffset($offset) {
40
+		$this->utcOffset = intval($offset);
41 41
 	}
42 42
 
43 43
 	/**
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 * @link http://php.net/manual/en/datetime.settimezone.php
61 61
 	 */
62 62
 	#[\ReturnTypeWillChange]
63
-	public function setTimezone( $timezone ) {
63
+	public function setTimezone($timezone) {
64 64
 		$this->utcOffset = 0;
65
-		parent::setTimezone( $timezone );
65
+		parent::setTimezone($timezone);
66 66
 
67 67
 		return $this;
68 68
 	}
Please login to merge, or discard this patch.
action-scheduler/classes/ActionScheduler_InvalidActionException.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -9,39 +9,39 @@
 block discarded – undo
9 9
  */
10 10
 class ActionScheduler_InvalidActionException extends \InvalidArgumentException implements ActionScheduler_Exception {
11 11
 
12
-	/**
13
-	 * Create a new exception when the action's schedule cannot be fetched.
14
-	 *
15
-	 * @param string $action_id The action ID with bad args.
16
-	 * @return static
17
-	 */
18
-	public static function from_schedule( $action_id, $schedule ) {
19
-		$message = sprintf(
20
-			/* translators: 1: action ID 2: schedule */
21
-			__( 'Action [%1$s] has an invalid schedule: %2$s', 'woocommerce' ),
22
-			$action_id,
23
-			var_export( $schedule, true )
24
-		);
12
+    /**
13
+     * Create a new exception when the action's schedule cannot be fetched.
14
+     *
15
+     * @param string $action_id The action ID with bad args.
16
+     * @return static
17
+     */
18
+    public static function from_schedule( $action_id, $schedule ) {
19
+        $message = sprintf(
20
+            /* translators: 1: action ID 2: schedule */
21
+            __( 'Action [%1$s] has an invalid schedule: %2$s', 'woocommerce' ),
22
+            $action_id,
23
+            var_export( $schedule, true )
24
+        );
25 25
 
26
-		return new static( $message );
27
-	}
26
+        return new static( $message );
27
+    }
28 28
 
29
-	/**
30
-	 * Create a new exception when the action's args cannot be decoded to an array.
31
-	 *
32
-	 * @author Jeremy Pry
33
-	 *
34
-	 * @param string $action_id The action ID with bad args.
35
-	 * @return static
36
-	 */
37
-	public static function from_decoding_args( $action_id, $args = array() ) {
38
-		$message = sprintf(
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' ),
41
-			$action_id,
42
-			var_export( $args, true )
43
-		);
29
+    /**
30
+     * Create a new exception when the action's args cannot be decoded to an array.
31
+     *
32
+     * @author Jeremy Pry
33
+     *
34
+     * @param string $action_id The action ID with bad args.
35
+     * @return static
36
+     */
37
+    public static function from_decoding_args( $action_id, $args = array() ) {
38
+        $message = sprintf(
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' ),
41
+            $action_id,
42
+            var_export( $args, true )
43
+        );
44 44
 
45
-		return new static( $message );
46
-	}
45
+        return new static( $message );
46
+    }
47 47
 }
Please login to merge, or discard this 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 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
  * Class ActionScheduler_Schedule
5 5
  */
6 6
 interface ActionScheduler_Schedule {
7
-	/**
8
-	 * @param DateTime $after
9
-	 * @return DateTime|null
10
-	 */
11
-	public function next( DateTime $after = NULL );
7
+    /**
8
+     * @param DateTime $after
9
+     * @return DateTime|null
10
+     */
11
+    public function next( DateTime $after = NULL );
12 12
 
13
-	/**
14
-	 * @return bool
15
-	 */
16
-	public function is_recurring();
13
+    /**
14
+     * @return bool
15
+     */
16
+    public function is_recurring();
17 17
 }
18
- 
19 18
\ No newline at end of file
19
+    
20 20
\ No newline at end of file
Please login to merge, or discard this 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 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -5,77 +5,77 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_IntervalSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule {
7 7
 
8
-	/**
9
-	 * Deprecated property @see $this->__wakeup() for details.
10
-	 **/
11
-	private $start_timestamp = NULL;
8
+    /**
9
+     * Deprecated property @see $this->__wakeup() for details.
10
+     **/
11
+    private $start_timestamp = NULL;
12 12
 
13
-	/**
14
-	 * Deprecated property @see $this->__wakeup() for details.
15
-	 **/
16
-	private $interval_in_seconds = NULL;
13
+    /**
14
+     * Deprecated property @see $this->__wakeup() for details.
15
+     **/
16
+    private $interval_in_seconds = NULL;
17 17
 
18
-	/**
19
-	 * Calculate when this schedule should start after a given date & time using
20
-	 * the number of seconds between recurrences.
21
-	 *
22
-	 * @param DateTime $after
23
-	 * @return DateTime
24
-	 */
25
-	protected function calculate_next( DateTime $after ) {
26
-		$after->modify( '+' . (int) $this->get_recurrence() . ' seconds' );
27
-		return $after;
28
-	}
18
+    /**
19
+     * Calculate when this schedule should start after a given date & time using
20
+     * the number of seconds between recurrences.
21
+     *
22
+     * @param DateTime $after
23
+     * @return DateTime
24
+     */
25
+    protected function calculate_next( DateTime $after ) {
26
+        $after->modify( '+' . (int) $this->get_recurrence() . ' seconds' );
27
+        return $after;
28
+    }
29 29
 
30
-	/**
31
-	 * @return int
32
-	 */
33
-	public function interval_in_seconds() {
34
-		_deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' );
35
-		return (int) $this->get_recurrence();
36
-	}
30
+    /**
31
+     * @return int
32
+     */
33
+    public function interval_in_seconds() {
34
+        _deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' );
35
+        return (int) $this->get_recurrence();
36
+    }
37 37
 
38
-	/**
39
-	 * Serialize interval schedules with data required prior to AS 3.0.0
40
-	 *
41
-	 * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to
42
-	 * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
43
-	 * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
44
-	 * aligned properties and property names for better inheritance. To guard against the
45
-	 * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to
46
-	 * also store the data with the old property names so if it's unserialized in AS < 3.0,
47
-	 * the schedule doesn't end up with a null/false/0 recurrence.
48
-	 *
49
-	 * @return array
50
-	 */
51
-	public function __sleep() {
38
+    /**
39
+     * Serialize interval schedules with data required prior to AS 3.0.0
40
+     *
41
+     * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to
42
+     * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
43
+     * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
44
+     * aligned properties and property names for better inheritance. To guard against the
45
+     * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to
46
+     * also store the data with the old property names so if it's unserialized in AS < 3.0,
47
+     * the schedule doesn't end up with a null/false/0 recurrence.
48
+     *
49
+     * @return array
50
+     */
51
+    public function __sleep() {
52 52
 
53
-		$sleep_params = parent::__sleep();
53
+        $sleep_params = parent::__sleep();
54 54
 
55
-		$this->start_timestamp     = $this->scheduled_timestamp;
56
-		$this->interval_in_seconds = $this->recurrence;
55
+        $this->start_timestamp     = $this->scheduled_timestamp;
56
+        $this->interval_in_seconds = $this->recurrence;
57 57
 
58
-		return array_merge( $sleep_params, array(
59
-			'start_timestamp',
60
-			'interval_in_seconds'
61
-		) );
62
-	}
58
+        return array_merge( $sleep_params, array(
59
+            'start_timestamp',
60
+            'interval_in_seconds'
61
+        ) );
62
+    }
63 63
 
64
-	/**
65
-	 * Unserialize interval schedules serialized/stored prior to AS 3.0.0
66
-	 *
67
-	 * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
68
-	 */
69
-	public function __wakeup() {
70
-		if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
71
-			$this->scheduled_timestamp = $this->start_timestamp;
72
-			unset( $this->start_timestamp );
73
-		}
64
+    /**
65
+     * Unserialize interval schedules serialized/stored prior to AS 3.0.0
66
+     *
67
+     * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
68
+     */
69
+    public function __wakeup() {
70
+        if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
71
+            $this->scheduled_timestamp = $this->start_timestamp;
72
+            unset( $this->start_timestamp );
73
+        }
74 74
 
75
-		if ( is_null( $this->recurrence ) && ! is_null( $this->interval_in_seconds ) ) {
76
-			$this->recurrence = $this->interval_in_seconds;
77
-			unset( $this->interval_in_seconds );
78
-		}
79
-		parent::__wakeup();
80
-	}
75
+        if ( is_null( $this->recurrence ) && ! is_null( $this->interval_in_seconds ) ) {
76
+            $this->recurrence = $this->interval_in_seconds;
77
+            unset( $this->interval_in_seconds );
78
+        }
79
+        parent::__wakeup();
80
+    }
81 81
 }
Please login to merge, or discard this 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 2 patches
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -5,98 +5,98 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_CronSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule {
7 7
 
8
-	/**
9
-	 * Deprecated property @see $this->__wakeup() for details.
10
-	 **/
11
-	private $start_timestamp = NULL;
12
-
13
-	/**
14
-	 * Deprecated property @see $this->__wakeup() for details.
15
-	 **/
16
-	private $cron = NULL;
17
-
18
-	/**
19
-	 * Wrapper for parent constructor to accept a cron expression string and map it to a CronExpression for this
20
-	 * objects $recurrence property.
21
-	 *
22
-	 * @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used.
23
-	 * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance.
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
-	 */
26
-	public function __construct( DateTime $start, $recurrence, DateTime $first = null ) {
27
-		if ( ! is_a( $recurrence, 'CronExpression' ) ) {
28
-			$recurrence = CronExpression::factory( $recurrence );
29
-		}
30
-
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 );
33
-
34
-		// parent::__construct() will set this to $date by default, but that may be different to $start now.
35
-		$first = empty( $first ) ? $start : $first;
36
-
37
-		parent::__construct( $date, $recurrence, $first );
38
-	}
39
-
40
-	/**
41
-	 * Calculate when an instance of this schedule would start based on a given
42
-	 * date & time using its the CronExpression.
43
-	 *
44
-	 * @param DateTime $after
45
-	 * @return DateTime
46
-	 */
47
-	protected function calculate_next( DateTime $after ) {
48
-		return $this->recurrence->getNextRunDate( $after, 0, false );
49
-	}
50
-
51
-	/**
52
-	 * @return string
53
-	 */
54
-	public function get_recurrence() {
55
-		return strval( $this->recurrence );
56
-	}
57
-
58
-	/**
59
-	 * Serialize cron schedules with data required prior to AS 3.0.0
60
-	 *
61
-	 * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to
62
-	 * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
63
-	 * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
64
-	 * aligned properties and property names for better inheritance. To guard against the
65
-	 * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to
66
-	 * also store the data with the old property names so if it's unserialized in AS < 3.0,
67
-	 * the schedule doesn't end up with a null recurrence.
68
-	 *
69
-	 * @return array
70
-	 */
71
-	public function __sleep() {
72
-
73
-		$sleep_params = parent::__sleep();
74
-
75
-		$this->start_timestamp = $this->scheduled_timestamp;
76
-		$this->cron            = $this->recurrence;
77
-
78
-		return array_merge( $sleep_params, array(
79
-			'start_timestamp',
80
-			'cron'
81
-		) );
82
-	}
83
-
84
-	/**
85
-	 * Unserialize cron schedules serialized/stored prior to AS 3.0.0
86
-	 *
87
-	 * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
88
-	 */
89
-	public function __wakeup() {
90
-		if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
91
-			$this->scheduled_timestamp = $this->start_timestamp;
92
-			unset( $this->start_timestamp );
93
-		}
94
-
95
-		if ( is_null( $this->recurrence ) && ! is_null( $this->cron ) ) {
96
-			$this->recurrence = $this->cron;
97
-			unset( $this->cron );
98
-		}
99
-		parent::__wakeup();
100
-	}
8
+    /**
9
+     * Deprecated property @see $this->__wakeup() for details.
10
+     **/
11
+    private $start_timestamp = NULL;
12
+
13
+    /**
14
+     * Deprecated property @see $this->__wakeup() for details.
15
+     **/
16
+    private $cron = NULL;
17
+
18
+    /**
19
+     * Wrapper for parent constructor to accept a cron expression string and map it to a CronExpression for this
20
+     * objects $recurrence property.
21
+     *
22
+     * @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used.
23
+     * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance.
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
+     */
26
+    public function __construct( DateTime $start, $recurrence, DateTime $first = null ) {
27
+        if ( ! is_a( $recurrence, 'CronExpression' ) ) {
28
+            $recurrence = CronExpression::factory( $recurrence );
29
+        }
30
+
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 );
33
+
34
+        // parent::__construct() will set this to $date by default, but that may be different to $start now.
35
+        $first = empty( $first ) ? $start : $first;
36
+
37
+        parent::__construct( $date, $recurrence, $first );
38
+    }
39
+
40
+    /**
41
+     * Calculate when an instance of this schedule would start based on a given
42
+     * date & time using its the CronExpression.
43
+     *
44
+     * @param DateTime $after
45
+     * @return DateTime
46
+     */
47
+    protected function calculate_next( DateTime $after ) {
48
+        return $this->recurrence->getNextRunDate( $after, 0, false );
49
+    }
50
+
51
+    /**
52
+     * @return string
53
+     */
54
+    public function get_recurrence() {
55
+        return strval( $this->recurrence );
56
+    }
57
+
58
+    /**
59
+     * Serialize cron schedules with data required prior to AS 3.0.0
60
+     *
61
+     * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to
62
+     * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
63
+     * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
64
+     * aligned properties and property names for better inheritance. To guard against the
65
+     * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to
66
+     * also store the data with the old property names so if it's unserialized in AS < 3.0,
67
+     * the schedule doesn't end up with a null recurrence.
68
+     *
69
+     * @return array
70
+     */
71
+    public function __sleep() {
72
+
73
+        $sleep_params = parent::__sleep();
74
+
75
+        $this->start_timestamp = $this->scheduled_timestamp;
76
+        $this->cron            = $this->recurrence;
77
+
78
+        return array_merge( $sleep_params, array(
79
+            'start_timestamp',
80
+            'cron'
81
+        ) );
82
+    }
83
+
84
+    /**
85
+     * Unserialize cron schedules serialized/stored prior to AS 3.0.0
86
+     *
87
+     * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
88
+     */
89
+    public function __wakeup() {
90
+        if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
91
+            $this->scheduled_timestamp = $this->start_timestamp;
92
+            unset( $this->start_timestamp );
93
+        }
94
+
95
+        if ( is_null( $this->recurrence ) && ! is_null( $this->cron ) ) {
96
+            $this->recurrence = $this->cron;
97
+            unset( $this->cron );
98
+        }
99
+        parent::__wakeup();
100
+    }
101 101
 }
102 102
 
Please login to merge, or discard this 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 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -5,53 +5,53 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_CanceledSchedule extends ActionScheduler_SimpleSchedule {
7 7
 
8
-	/**
9
-	 * Deprecated property @see $this->__wakeup() for details.
10
-	 **/
11
-	private $timestamp = NULL;
8
+    /**
9
+     * Deprecated property @see $this->__wakeup() for details.
10
+     **/
11
+    private $timestamp = NULL;
12 12
 
13
-	/**
14
-	 * @param DateTime $after
15
-	 *
16
-	 * @return DateTime|null
17
-	 */
18
-	public function calculate_next( DateTime $after ) {
19
-		return null;
20
-	}
13
+    /**
14
+     * @param DateTime $after
15
+     *
16
+     * @return DateTime|null
17
+     */
18
+    public function calculate_next( DateTime $after ) {
19
+        return null;
20
+    }
21 21
 
22
-	/**
23
-	 * Cancelled actions should never have a next schedule, even if get_next()
24
-	 * is called with $after < $this->scheduled_date.
25
-	 *
26
-	 * @param DateTime $after
27
-	 * @return DateTime|null
28
-	 */
29
-	public function get_next( DateTime $after ) {
30
-		return null;
31
-	}
22
+    /**
23
+     * Cancelled actions should never have a next schedule, even if get_next()
24
+     * is called with $after < $this->scheduled_date.
25
+     *
26
+     * @param DateTime $after
27
+     * @return DateTime|null
28
+     */
29
+    public function get_next( DateTime $after ) {
30
+        return null;
31
+    }
32 32
 
33
-	/**
34
-	 * @return bool
35
-	 */
36
-	public function is_recurring() {
37
-		return false;
38
-	}
33
+    /**
34
+     * @return bool
35
+     */
36
+    public function is_recurring() {
37
+        return false;
38
+    }
39 39
 
40
-	/**
41
-	 * Unserialize recurring schedules serialized/stored prior to AS 3.0.0
42
-	 *
43
-	 * Prior to Action Scheduler 3.0.0, schedules used different property names to refer
44
-	 * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
45
-	 * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
46
-	 * aligned properties and property names for better inheritance. To maintain backward
47
-	 * compatibility with schedules serialized and stored prior to 3.0, we need to correctly
48
-	 * map the old property names with matching visibility.
49
-	 */
50
-	public function __wakeup() {
51
-		if ( ! is_null( $this->timestamp ) ) {
52
-			$this->scheduled_timestamp = $this->timestamp;
53
-			unset( $this->timestamp );
54
-		}
55
-		parent::__wakeup();
56
-	}
40
+    /**
41
+     * Unserialize recurring schedules serialized/stored prior to AS 3.0.0
42
+     *
43
+     * Prior to Action Scheduler 3.0.0, schedules used different property names to refer
44
+     * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
45
+     * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
46
+     * aligned properties and property names for better inheritance. To maintain backward
47
+     * compatibility with schedules serialized and stored prior to 3.0, we need to correctly
48
+     * map the old property names with matching visibility.
49
+     */
50
+    public function __wakeup() {
51
+        if ( ! is_null( $this->timestamp ) ) {
52
+            $this->scheduled_timestamp = $this->timestamp;
53
+            unset( $this->timestamp );
54
+        }
55
+        parent::__wakeup();
56
+    }
57 57
 }
Please login to merge, or discard this 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 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_NullSchedule extends ActionScheduler_SimpleSchedule {
7 7
 
8
-	/**
9
-	 * Make the $date param optional and default to null.
10
-	 *
11
-	 * @param null $date The date & time to run the action.
12
-	 */
13
-	public function __construct( DateTime $date = null ) {
14
-		$this->scheduled_date = null;
15
-	}
8
+    /**
9
+     * Make the $date param optional and default to null.
10
+     *
11
+     * @param null $date The date & time to run the action.
12
+     */
13
+    public function __construct( DateTime $date = null ) {
14
+        $this->scheduled_date = null;
15
+    }
16 16
 
17
-	/**
18
-	 * This schedule has no scheduled DateTime, so we need to override the parent __sleep()
19
-	 * @return array
20
-	 */
21
-	public function __sleep() {
22
-		return array();
23
-	}
17
+    /**
18
+     * This schedule has no scheduled DateTime, so we need to override the parent __sleep()
19
+     * @return array
20
+     */
21
+    public function __sleep() {
22
+        return array();
23
+    }
24 24
 
25
-	public function __wakeup() {
26
-		$this->scheduled_date = null;
27
-	}
25
+    public function __wakeup() {
26
+        $this->scheduled_date = null;
27
+    }
28 28
 }
Please login to merge, or discard this 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 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -5,67 +5,67 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_SimpleSchedule extends ActionScheduler_Abstract_Schedule {
7 7
 
8
-	/**
9
-	 * Deprecated property @see $this->__wakeup() for details.
10
-	 **/
11
-	private $timestamp = NULL;
8
+    /**
9
+     * Deprecated property @see $this->__wakeup() for details.
10
+     **/
11
+    private $timestamp = NULL;
12 12
 
13
-	/**
14
-	 * @param DateTime $after
15
-	 *
16
-	 * @return DateTime|null
17
-	 */
18
-	public function calculate_next( DateTime $after ) {
19
-		return null;
20
-	}
13
+    /**
14
+     * @param DateTime $after
15
+     *
16
+     * @return DateTime|null
17
+     */
18
+    public function calculate_next( DateTime $after ) {
19
+        return null;
20
+    }
21 21
 
22
-	/**
23
-	 * @return bool
24
-	 */
25
-	public function is_recurring() {
26
-		return false;
27
-	}
22
+    /**
23
+     * @return bool
24
+     */
25
+    public function is_recurring() {
26
+        return false;
27
+    }
28 28
 
29
-	/**
30
-	 * Serialize schedule with data required prior to AS 3.0.0
31
-	 *
32
-	 * Prior to Action Scheduler 3.0.0, schedules used different property names to refer
33
-	 * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
34
-	 * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
35
-	 * aligned properties and property names for better inheritance. To guard against the
36
-	 * scheduled date for single actions always being seen as "now" if downgrading to
37
-	 * Action Scheduler < 3.0.0, we need to also store the data with the old property names
38
-	 * so if it's unserialized in AS < 3.0, the schedule doesn't end up with a null recurrence.
39
-	 *
40
-	 * @return array
41
-	 */
42
-	public function __sleep() {
29
+    /**
30
+     * Serialize schedule with data required prior to AS 3.0.0
31
+     *
32
+     * Prior to Action Scheduler 3.0.0, schedules used different property names to refer
33
+     * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
34
+     * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
35
+     * aligned properties and property names for better inheritance. To guard against the
36
+     * scheduled date for single actions always being seen as "now" if downgrading to
37
+     * Action Scheduler < 3.0.0, we need to also store the data with the old property names
38
+     * so if it's unserialized in AS < 3.0, the schedule doesn't end up with a null recurrence.
39
+     *
40
+     * @return array
41
+     */
42
+    public function __sleep() {
43 43
 
44
-		$sleep_params = parent::__sleep();
44
+        $sleep_params = parent::__sleep();
45 45
 
46
-		$this->timestamp = $this->scheduled_timestamp;
46
+        $this->timestamp = $this->scheduled_timestamp;
47 47
 
48
-		return array_merge( $sleep_params, array(
49
-			'timestamp',
50
-		) );
51
-	}
48
+        return array_merge( $sleep_params, array(
49
+            'timestamp',
50
+        ) );
51
+    }
52 52
 
53
-	/**
54
-	 * Unserialize recurring schedules serialized/stored prior to AS 3.0.0
55
-	 *
56
-	 * Prior to Action Scheduler 3.0.0, schedules used different property names to refer
57
-	 * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
58
-	 * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
59
-	 * aligned properties and property names for better inheritance. To maintain backward
60
-	 * compatibility with schedules serialized and stored prior to 3.0, we need to correctly
61
-	 * map the old property names with matching visibility.
62
-	 */
63
-	public function __wakeup() {
53
+    /**
54
+     * Unserialize recurring schedules serialized/stored prior to AS 3.0.0
55
+     *
56
+     * Prior to Action Scheduler 3.0.0, schedules used different property names to refer
57
+     * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp
58
+     * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0
59
+     * aligned properties and property names for better inheritance. To maintain backward
60
+     * compatibility with schedules serialized and stored prior to 3.0, we need to correctly
61
+     * map the old property names with matching visibility.
62
+     */
63
+    public function __wakeup() {
64 64
 
65
-		if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->timestamp ) ) {
66
-			$this->scheduled_timestamp = $this->timestamp;
67
-			unset( $this->timestamp );
68
-		}
69
-		parent::__wakeup();
70
-	}
65
+        if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->timestamp ) ) {
66
+            $this->scheduled_timestamp = $this->timestamp;
67
+            unset( $this->timestamp );
68
+        }
69
+        parent::__wakeup();
70
+    }
71 71
 }
Please login to merge, or discard this 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.