Completed
Push — develop ( 36a199...920e68 )
by David
01:14
created
action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -17,105 +17,105 @@
 block discarded – undo
17 17
  */
18 18
 class CronExpression_DayOfWeekField extends CronExpression_AbstractField {
19 19
 
20
-	/**
21
-	 * {@inheritdoc}
22
-	 */
23
-	public function isSatisfiedBy( DateTime $date, $value ) {
24
-		if ( $value == '?' ) {
25
-			return true;
26
-		}
20
+    /**
21
+     * {@inheritdoc}
22
+     */
23
+    public function isSatisfiedBy( DateTime $date, $value ) {
24
+        if ( $value == '?' ) {
25
+            return true;
26
+        }
27 27
 
28
-		// Convert text day of the week values to integers
29
-		$value = str_ireplace(
30
-			array( 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT' ),
31
-			range( 0, 6 ),
32
-			$value
33
-		);
28
+        // Convert text day of the week values to integers
29
+        $value = str_ireplace(
30
+            array( 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT' ),
31
+            range( 0, 6 ),
32
+            $value
33
+        );
34 34
 
35
-		$currentYear    = $date->format( 'Y' );
36
-		$currentMonth   = $date->format( 'm' );
37
-		$lastDayOfMonth = $date->format( 't' );
35
+        $currentYear    = $date->format( 'Y' );
36
+        $currentMonth   = $date->format( 'm' );
37
+        $lastDayOfMonth = $date->format( 't' );
38 38
 
39
-		// Find out if this is the last specific weekday of the month
40
-		if ( strpos( $value, 'L' ) ) {
41
-			$weekday = str_replace( '7', '0', substr( $value, 0, strpos( $value, 'L' ) ) );
42
-			$tdate   = clone $date;
43
-			$tdate->setDate( $currentYear, $currentMonth, $lastDayOfMonth );
44
-			while ( $tdate->format( 'w' ) != $weekday ) {
45
-				$tdate->setDate( $currentYear, $currentMonth, --$lastDayOfMonth );
46
-			}
39
+        // Find out if this is the last specific weekday of the month
40
+        if ( strpos( $value, 'L' ) ) {
41
+            $weekday = str_replace( '7', '0', substr( $value, 0, strpos( $value, 'L' ) ) );
42
+            $tdate   = clone $date;
43
+            $tdate->setDate( $currentYear, $currentMonth, $lastDayOfMonth );
44
+            while ( $tdate->format( 'w' ) != $weekday ) {
45
+                $tdate->setDate( $currentYear, $currentMonth, --$lastDayOfMonth );
46
+            }
47 47
 
48
-			return $date->format( 'j' ) == $lastDayOfMonth;
49
-		}
48
+            return $date->format( 'j' ) == $lastDayOfMonth;
49
+        }
50 50
 
51
-		// Handle # hash tokens
52
-		if ( strpos( $value, '#' ) ) {
53
-			list($weekday, $nth) = explode( '#', $value );
54
-			// Validate the hash fields
55
-			if ( $weekday < 1 || $weekday > 5 ) {
56
-				throw new InvalidArgumentException( "Weekday must be a value between 1 and 5. {$weekday} given" );
57
-			}
58
-			if ( $nth > 5 ) {
59
-				throw new InvalidArgumentException( 'There are never more than 5 of a given weekday in a month' );
60
-			}
61
-			// The current weekday must match the targeted weekday to proceed
62
-			if ( $date->format( 'N' ) != $weekday ) {
63
-				return false;
64
-			}
51
+        // Handle # hash tokens
52
+        if ( strpos( $value, '#' ) ) {
53
+            list($weekday, $nth) = explode( '#', $value );
54
+            // Validate the hash fields
55
+            if ( $weekday < 1 || $weekday > 5 ) {
56
+                throw new InvalidArgumentException( "Weekday must be a value between 1 and 5. {$weekday} given" );
57
+            }
58
+            if ( $nth > 5 ) {
59
+                throw new InvalidArgumentException( 'There are never more than 5 of a given weekday in a month' );
60
+            }
61
+            // The current weekday must match the targeted weekday to proceed
62
+            if ( $date->format( 'N' ) != $weekday ) {
63
+                return false;
64
+            }
65 65
 
66
-			$tdate = clone $date;
67
-			$tdate->setDate( $currentYear, $currentMonth, 1 );
68
-			$dayCount   = 0;
69
-			$currentDay = 1;
70
-			while ( $currentDay < $lastDayOfMonth + 1 ) {
71
-				if ( $tdate->format( 'N' ) == $weekday ) {
72
-					if ( ++$dayCount >= $nth ) {
73
-						break;
74
-					}
75
-				}
76
-				$tdate->setDate( $currentYear, $currentMonth, ++$currentDay );
77
-			}
66
+            $tdate = clone $date;
67
+            $tdate->setDate( $currentYear, $currentMonth, 1 );
68
+            $dayCount   = 0;
69
+            $currentDay = 1;
70
+            while ( $currentDay < $lastDayOfMonth + 1 ) {
71
+                if ( $tdate->format( 'N' ) == $weekday ) {
72
+                    if ( ++$dayCount >= $nth ) {
73
+                        break;
74
+                    }
75
+                }
76
+                $tdate->setDate( $currentYear, $currentMonth, ++$currentDay );
77
+            }
78 78
 
79
-			return $date->format( 'j' ) == $currentDay;
80
-		}
79
+            return $date->format( 'j' ) == $currentDay;
80
+        }
81 81
 
82
-		// Handle day of the week values
83
-		if ( strpos( $value, '-' ) ) {
84
-			$parts = explode( '-', $value );
85
-			if ( $parts[0] == '7' ) {
86
-				$parts[0] = '0';
87
-			} elseif ( $parts[1] == '0' ) {
88
-				$parts[1] = '7';
89
-			}
90
-			$value = implode( '-', $parts );
91
-		}
82
+        // Handle day of the week values
83
+        if ( strpos( $value, '-' ) ) {
84
+            $parts = explode( '-', $value );
85
+            if ( $parts[0] == '7' ) {
86
+                $parts[0] = '0';
87
+            } elseif ( $parts[1] == '0' ) {
88
+                $parts[1] = '7';
89
+            }
90
+            $value = implode( '-', $parts );
91
+        }
92 92
 
93
-		// Test to see which Sunday to use -- 0 == 7 == Sunday
94
-		$format     = in_array( 7, str_split( $value ) ) ? 'N' : 'w';
95
-		$fieldValue = $date->format( $format );
93
+        // Test to see which Sunday to use -- 0 == 7 == Sunday
94
+        $format     = in_array( 7, str_split( $value ) ) ? 'N' : 'w';
95
+        $fieldValue = $date->format( $format );
96 96
 
97
-		return $this->isSatisfied( $fieldValue, $value );
98
-	}
97
+        return $this->isSatisfied( $fieldValue, $value );
98
+    }
99 99
 
100
-	/**
101
-	 * {@inheritdoc}
102
-	 */
103
-	public function increment( DateTime $date, $invert = false ) {
104
-		if ( $invert ) {
105
-			$date->modify( '-1 day' );
106
-			$date->setTime( 23, 59, 0 );
107
-		} else {
108
-			$date->modify( '+1 day' );
109
-			$date->setTime( 0, 0, 0 );
110
-		}
100
+    /**
101
+     * {@inheritdoc}
102
+     */
103
+    public function increment( DateTime $date, $invert = false ) {
104
+        if ( $invert ) {
105
+            $date->modify( '-1 day' );
106
+            $date->setTime( 23, 59, 0 );
107
+        } else {
108
+            $date->modify( '+1 day' );
109
+            $date->setTime( 0, 0, 0 );
110
+        }
111 111
 
112
-		return $this;
113
-	}
112
+        return $this;
113
+    }
114 114
 
115
-	/**
116
-	 * {@inheritdoc}
117
-	 */
118
-	public function validate( $value ) {
119
-		return (bool) preg_match( '/[\*,\/\-0-9A-Z]+/', $value );
120
-	}
115
+    /**
116
+     * {@inheritdoc}
117
+     */
118
+    public function validate( $value ) {
119
+        return (bool) preg_match( '/[\*,\/\-0-9A-Z]+/', $value );
120
+    }
121 121
 }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -20,93 +20,93 @@  discard block
 block discarded – undo
20 20
 	/**
21 21
 	 * {@inheritdoc}
22 22
 	 */
23
-	public function isSatisfiedBy( DateTime $date, $value ) {
24
-		if ( $value == '?' ) {
23
+	public function isSatisfiedBy(DateTime $date, $value) {
24
+		if ($value == '?') {
25 25
 			return true;
26 26
 		}
27 27
 
28 28
 		// Convert text day of the week values to integers
29 29
 		$value = str_ireplace(
30
-			array( 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT' ),
31
-			range( 0, 6 ),
30
+			array('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'),
31
+			range(0, 6),
32 32
 			$value
33 33
 		);
34 34
 
35
-		$currentYear    = $date->format( 'Y' );
36
-		$currentMonth   = $date->format( 'm' );
37
-		$lastDayOfMonth = $date->format( 't' );
35
+		$currentYear    = $date->format('Y');
36
+		$currentMonth   = $date->format('m');
37
+		$lastDayOfMonth = $date->format('t');
38 38
 
39 39
 		// Find out if this is the last specific weekday of the month
40
-		if ( strpos( $value, 'L' ) ) {
41
-			$weekday = str_replace( '7', '0', substr( $value, 0, strpos( $value, 'L' ) ) );
40
+		if (strpos($value, 'L')) {
41
+			$weekday = str_replace('7', '0', substr($value, 0, strpos($value, 'L')));
42 42
 			$tdate   = clone $date;
43
-			$tdate->setDate( $currentYear, $currentMonth, $lastDayOfMonth );
44
-			while ( $tdate->format( 'w' ) != $weekday ) {
45
-				$tdate->setDate( $currentYear, $currentMonth, --$lastDayOfMonth );
43
+			$tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth);
44
+			while ($tdate->format('w') != $weekday) {
45
+				$tdate->setDate($currentYear, $currentMonth, --$lastDayOfMonth);
46 46
 			}
47 47
 
48
-			return $date->format( 'j' ) == $lastDayOfMonth;
48
+			return $date->format('j') == $lastDayOfMonth;
49 49
 		}
50 50
 
51 51
 		// Handle # hash tokens
52
-		if ( strpos( $value, '#' ) ) {
53
-			list($weekday, $nth) = explode( '#', $value );
52
+		if (strpos($value, '#')) {
53
+			list($weekday, $nth) = explode('#', $value);
54 54
 			// Validate the hash fields
55
-			if ( $weekday < 1 || $weekday > 5 ) {
56
-				throw new InvalidArgumentException( "Weekday must be a value between 1 and 5. {$weekday} given" );
55
+			if ($weekday < 1 || $weekday > 5) {
56
+				throw new InvalidArgumentException("Weekday must be a value between 1 and 5. {$weekday} given");
57 57
 			}
58
-			if ( $nth > 5 ) {
59
-				throw new InvalidArgumentException( 'There are never more than 5 of a given weekday in a month' );
58
+			if ($nth > 5) {
59
+				throw new InvalidArgumentException('There are never more than 5 of a given weekday in a month');
60 60
 			}
61 61
 			// The current weekday must match the targeted weekday to proceed
62
-			if ( $date->format( 'N' ) != $weekday ) {
62
+			if ($date->format('N') != $weekday) {
63 63
 				return false;
64 64
 			}
65 65
 
66 66
 			$tdate = clone $date;
67
-			$tdate->setDate( $currentYear, $currentMonth, 1 );
67
+			$tdate->setDate($currentYear, $currentMonth, 1);
68 68
 			$dayCount   = 0;
69 69
 			$currentDay = 1;
70
-			while ( $currentDay < $lastDayOfMonth + 1 ) {
71
-				if ( $tdate->format( 'N' ) == $weekday ) {
70
+			while ($currentDay < $lastDayOfMonth + 1) {
71
+				if ($tdate->format('N') == $weekday) {
72 72
 					if ( ++$dayCount >= $nth ) {
73 73
 						break;
74 74
 					}
75 75
 				}
76
-				$tdate->setDate( $currentYear, $currentMonth, ++$currentDay );
76
+				$tdate->setDate($currentYear, $currentMonth, ++$currentDay);
77 77
 			}
78 78
 
79
-			return $date->format( 'j' ) == $currentDay;
79
+			return $date->format('j') == $currentDay;
80 80
 		}
81 81
 
82 82
 		// Handle day of the week values
83
-		if ( strpos( $value, '-' ) ) {
84
-			$parts = explode( '-', $value );
85
-			if ( $parts[0] == '7' ) {
83
+		if (strpos($value, '-')) {
84
+			$parts = explode('-', $value);
85
+			if ($parts[0] == '7') {
86 86
 				$parts[0] = '0';
87
-			} elseif ( $parts[1] == '0' ) {
87
+			} elseif ($parts[1] == '0') {
88 88
 				$parts[1] = '7';
89 89
 			}
90
-			$value = implode( '-', $parts );
90
+			$value = implode('-', $parts);
91 91
 		}
92 92
 
93 93
 		// Test to see which Sunday to use -- 0 == 7 == Sunday
94
-		$format     = in_array( 7, str_split( $value ) ) ? 'N' : 'w';
95
-		$fieldValue = $date->format( $format );
94
+		$format     = in_array(7, str_split($value)) ? 'N' : 'w';
95
+		$fieldValue = $date->format($format);
96 96
 
97
-		return $this->isSatisfied( $fieldValue, $value );
97
+		return $this->isSatisfied($fieldValue, $value);
98 98
 	}
99 99
 
100 100
 	/**
101 101
 	 * {@inheritdoc}
102 102
 	 */
103
-	public function increment( DateTime $date, $invert = false ) {
104
-		if ( $invert ) {
105
-			$date->modify( '-1 day' );
106
-			$date->setTime( 23, 59, 0 );
103
+	public function increment(DateTime $date, $invert = false) {
104
+		if ($invert) {
105
+			$date->modify('-1 day');
106
+			$date->setTime(23, 59, 0);
107 107
 		} else {
108
-			$date->modify( '+1 day' );
109
-			$date->setTime( 0, 0, 0 );
108
+			$date->modify('+1 day');
109
+			$date->setTime(0, 0, 0);
110 110
 		}
111 111
 
112 112
 		return $this;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	/**
116 116
 	 * {@inheritdoc}
117 117
 	 */
118
-	public function validate( $value ) {
119
-		return (bool) preg_match( '/[\*,\/\-0-9A-Z]+/', $value );
118
+	public function validate($value) {
119
+		return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value);
120 120
 	}
121 121
 }
Please login to merge, or discard this patch.
action-scheduler/lib/cron-expression/CronExpression_MinutesField.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@
 block discarded – undo
7 7
  */
8 8
 class CronExpression_MinutesField extends CronExpression_AbstractField {
9 9
 
10
-	/**
11
-	 * {@inheritdoc}
12
-	 */
13
-	public function isSatisfiedBy( DateTime $date, $value ) {
14
-		return $this->isSatisfied( $date->format( 'i' ), $value );
15
-	}
10
+    /**
11
+     * {@inheritdoc}
12
+     */
13
+    public function isSatisfiedBy( DateTime $date, $value ) {
14
+        return $this->isSatisfied( $date->format( 'i' ), $value );
15
+    }
16 16
 
17
-	/**
18
-	 * {@inheritdoc}
19
-	 */
20
-	public function increment( DateTime $date, $invert = false ) {
21
-		if ( $invert ) {
22
-			$date->modify( '-1 minute' );
23
-		} else {
24
-			$date->modify( '+1 minute' );
25
-		}
17
+    /**
18
+     * {@inheritdoc}
19
+     */
20
+    public function increment( DateTime $date, $invert = false ) {
21
+        if ( $invert ) {
22
+            $date->modify( '-1 minute' );
23
+        } else {
24
+            $date->modify( '+1 minute' );
25
+        }
26 26
 
27
-		return $this;
28
-	}
27
+        return $this;
28
+    }
29 29
 
30
-	/**
31
-	 * {@inheritdoc}
32
-	 */
33
-	public function validate( $value ) {
34
-		return (bool) preg_match( '/[\*,\/\-0-9]+/', $value );
35
-	}
30
+    /**
31
+     * {@inheritdoc}
32
+     */
33
+    public function validate( $value ) {
34
+        return (bool) preg_match( '/[\*,\/\-0-9]+/', $value );
35
+    }
36 36
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
 	/**
11 11
 	 * {@inheritdoc}
12 12
 	 */
13
-	public function isSatisfiedBy( DateTime $date, $value ) {
14
-		return $this->isSatisfied( $date->format( 'i' ), $value );
13
+	public function isSatisfiedBy(DateTime $date, $value) {
14
+		return $this->isSatisfied($date->format('i'), $value);
15 15
 	}
16 16
 
17 17
 	/**
18 18
 	 * {@inheritdoc}
19 19
 	 */
20
-	public function increment( DateTime $date, $invert = false ) {
21
-		if ( $invert ) {
22
-			$date->modify( '-1 minute' );
20
+	public function increment(DateTime $date, $invert = false) {
21
+		if ($invert) {
22
+			$date->modify('-1 minute');
23 23
 		} else {
24
-			$date->modify( '+1 minute' );
24
+			$date->modify('+1 minute');
25 25
 		}
26 26
 
27 27
 		return $this;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * {@inheritdoc}
32 32
 	 */
33
-	public function validate( $value ) {
34
-		return (bool) preg_match( '/[\*,\/\-0-9]+/', $value );
33
+	public function validate($value) {
34
+		return (bool) preg_match('/[\*,\/\-0-9]+/', $value);
35 35
 	}
36 36
 }
Please login to merge, or discard this patch.
action-scheduler/lib/cron-expression/CronExpression_AbstractField.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -7,89 +7,89 @@
 block discarded – undo
7 7
  */
8 8
 abstract class CronExpression_AbstractField implements CronExpression_FieldInterface {
9 9
 
10
-	/**
11
-	 * Check to see if a field is satisfied by a value
12
-	 *
13
-	 * @param string $dateValue Date value to check
14
-	 * @param string $value     Value to test
15
-	 *
16
-	 * @return bool
17
-	 */
18
-	public function isSatisfied( $dateValue, $value ) {
19
-		if ( $this->isIncrementsOfRanges( $value ) ) {
20
-			return $this->isInIncrementsOfRanges( $dateValue, $value );
21
-		} elseif ( $this->isRange( $value ) ) {
22
-			return $this->isInRange( $dateValue, $value );
23
-		}
10
+    /**
11
+     * Check to see if a field is satisfied by a value
12
+     *
13
+     * @param string $dateValue Date value to check
14
+     * @param string $value     Value to test
15
+     *
16
+     * @return bool
17
+     */
18
+    public function isSatisfied( $dateValue, $value ) {
19
+        if ( $this->isIncrementsOfRanges( $value ) ) {
20
+            return $this->isInIncrementsOfRanges( $dateValue, $value );
21
+        } elseif ( $this->isRange( $value ) ) {
22
+            return $this->isInRange( $dateValue, $value );
23
+        }
24 24
 
25
-		return $value == '*' || $dateValue == $value;
26
-	}
25
+        return $value == '*' || $dateValue == $value;
26
+    }
27 27
 
28
-	/**
29
-	 * Check if a value is a range
30
-	 *
31
-	 * @param string $value Value to test
32
-	 *
33
-	 * @return bool
34
-	 */
35
-	public function isRange( $value ) {
36
-		return strpos( $value, '-' ) !== false;
37
-	}
28
+    /**
29
+     * Check if a value is a range
30
+     *
31
+     * @param string $value Value to test
32
+     *
33
+     * @return bool
34
+     */
35
+    public function isRange( $value ) {
36
+        return strpos( $value, '-' ) !== false;
37
+    }
38 38
 
39
-	/**
40
-	 * Check if a value is an increments of ranges
41
-	 *
42
-	 * @param string $value Value to test
43
-	 *
44
-	 * @return bool
45
-	 */
46
-	public function isIncrementsOfRanges( $value ) {
47
-		return strpos( $value, '/' ) !== false;
48
-	}
39
+    /**
40
+     * Check if a value is an increments of ranges
41
+     *
42
+     * @param string $value Value to test
43
+     *
44
+     * @return bool
45
+     */
46
+    public function isIncrementsOfRanges( $value ) {
47
+        return strpos( $value, '/' ) !== false;
48
+    }
49 49
 
50
-	/**
51
-	 * Test if a value is within a range
52
-	 *
53
-	 * @param string $dateValue Set date value
54
-	 * @param string $value     Value to test
55
-	 *
56
-	 * @return bool
57
-	 */
58
-	public function isInRange( $dateValue, $value ) {
59
-		$parts = array_map( 'trim', explode( '-', $value, 2 ) );
50
+    /**
51
+     * Test if a value is within a range
52
+     *
53
+     * @param string $dateValue Set date value
54
+     * @param string $value     Value to test
55
+     *
56
+     * @return bool
57
+     */
58
+    public function isInRange( $dateValue, $value ) {
59
+        $parts = array_map( 'trim', explode( '-', $value, 2 ) );
60 60
 
61
-		return $dateValue >= $parts[0] && $dateValue <= $parts[1];
62
-	}
61
+        return $dateValue >= $parts[0] && $dateValue <= $parts[1];
62
+    }
63 63
 
64
-	/**
65
-	 * Test if a value is within an increments of ranges (offset[-to]/step size)
66
-	 *
67
-	 * @param string $dateValue Set date value
68
-	 * @param string $value     Value to test
69
-	 *
70
-	 * @return bool
71
-	 */
72
-	public function isInIncrementsOfRanges( $dateValue, $value ) {
73
-		$parts    = array_map( 'trim', explode( '/', $value, 2 ) );
74
-		$stepSize = isset( $parts[1] ) ? $parts[1] : 0;
75
-		if ( $parts[0] == '*' || $parts[0] === '0' ) {
76
-			return (int) $dateValue % $stepSize == 0;
77
-		}
64
+    /**
65
+     * Test if a value is within an increments of ranges (offset[-to]/step size)
66
+     *
67
+     * @param string $dateValue Set date value
68
+     * @param string $value     Value to test
69
+     *
70
+     * @return bool
71
+     */
72
+    public function isInIncrementsOfRanges( $dateValue, $value ) {
73
+        $parts    = array_map( 'trim', explode( '/', $value, 2 ) );
74
+        $stepSize = isset( $parts[1] ) ? $parts[1] : 0;
75
+        if ( $parts[0] == '*' || $parts[0] === '0' ) {
76
+            return (int) $dateValue % $stepSize == 0;
77
+        }
78 78
 
79
-		$range  = explode( '-', $parts[0], 2 );
80
-		$offset = $range[0];
81
-		$to     = isset( $range[1] ) ? $range[1] : $dateValue;
82
-		// Ensure that the date value is within the range
83
-		if ( $dateValue < $offset || $dateValue > $to ) {
84
-			return false;
85
-		}
79
+        $range  = explode( '-', $parts[0], 2 );
80
+        $offset = $range[0];
81
+        $to     = isset( $range[1] ) ? $range[1] : $dateValue;
82
+        // Ensure that the date value is within the range
83
+        if ( $dateValue < $offset || $dateValue > $to ) {
84
+            return false;
85
+        }
86 86
 
87
-		for ( $i = $offset; $i <= $to; $i += $stepSize ) {
88
-			if ( $i == $dateValue ) {
89
-				return true;
90
-			}
91
-		}
87
+        for ( $i = $offset; $i <= $to; $i += $stepSize ) {
88
+            if ( $i == $dateValue ) {
89
+                return true;
90
+            }
91
+        }
92 92
 
93
-		return false;
94
-	}
93
+        return false;
94
+    }
95 95
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return bool
17 17
 	 */
18
-	public function isSatisfied( $dateValue, $value ) {
19
-		if ( $this->isIncrementsOfRanges( $value ) ) {
20
-			return $this->isInIncrementsOfRanges( $dateValue, $value );
21
-		} elseif ( $this->isRange( $value ) ) {
22
-			return $this->isInRange( $dateValue, $value );
18
+	public function isSatisfied($dateValue, $value) {
19
+		if ($this->isIncrementsOfRanges($value)) {
20
+			return $this->isInIncrementsOfRanges($dateValue, $value);
21
+		} elseif ($this->isRange($value)) {
22
+			return $this->isInRange($dateValue, $value);
23 23
 		}
24 24
 
25 25
 		return $value == '*' || $dateValue == $value;
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return bool
34 34
 	 */
35
-	public function isRange( $value ) {
36
-		return strpos( $value, '-' ) !== false;
35
+	public function isRange($value) {
36
+		return strpos($value, '-') !== false;
37 37
 	}
38 38
 
39 39
 	/**
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return bool
45 45
 	 */
46
-	public function isIncrementsOfRanges( $value ) {
47
-		return strpos( $value, '/' ) !== false;
46
+	public function isIncrementsOfRanges($value) {
47
+		return strpos($value, '/') !== false;
48 48
 	}
49 49
 
50 50
 	/**
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return bool
57 57
 	 */
58
-	public function isInRange( $dateValue, $value ) {
59
-		$parts = array_map( 'trim', explode( '-', $value, 2 ) );
58
+	public function isInRange($dateValue, $value) {
59
+		$parts = array_map('trim', explode('-', $value, 2));
60 60
 
61 61
 		return $dateValue >= $parts[0] && $dateValue <= $parts[1];
62 62
 	}
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return bool
71 71
 	 */
72
-	public function isInIncrementsOfRanges( $dateValue, $value ) {
73
-		$parts    = array_map( 'trim', explode( '/', $value, 2 ) );
74
-		$stepSize = isset( $parts[1] ) ? $parts[1] : 0;
75
-		if ( $parts[0] == '*' || $parts[0] === '0' ) {
72
+	public function isInIncrementsOfRanges($dateValue, $value) {
73
+		$parts    = array_map('trim', explode('/', $value, 2));
74
+		$stepSize = isset($parts[1]) ? $parts[1] : 0;
75
+		if ($parts[0] == '*' || $parts[0] === '0') {
76 76
 			return (int) $dateValue % $stepSize == 0;
77 77
 		}
78 78
 
79
-		$range  = explode( '-', $parts[0], 2 );
79
+		$range  = explode('-', $parts[0], 2);
80 80
 		$offset = $range[0];
81
-		$to     = isset( $range[1] ) ? $range[1] : $dateValue;
81
+		$to     = isset($range[1]) ? $range[1] : $dateValue;
82 82
 		// Ensure that the date value is within the range
83
-		if ( $dateValue < $offset || $dateValue > $to ) {
83
+		if ($dateValue < $offset || $dateValue > $to) {
84 84
 			return false;
85 85
 		}
86 86
 
87
-		for ( $i = $offset; $i <= $to; $i += $stepSize ) {
88
-			if ( $i == $dateValue ) {
87
+		for ($i = $offset; $i <= $to; $i += $stepSize) {
88
+			if ($i == $dateValue) {
89 89
 				return true;
90 90
 			}
91 91
 		}
Please login to merge, or discard this patch.
action-scheduler/lib/cron-expression/CronExpression_MonthField.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -7,56 +7,56 @@
 block discarded – undo
7 7
  */
8 8
 class CronExpression_MonthField extends CronExpression_AbstractField {
9 9
 
10
-	/**
11
-	 * {@inheritdoc}
12
-	 */
13
-	public function isSatisfiedBy( DateTime $date, $value ) {
14
-		// Convert text month values to integers
15
-		$value = str_ireplace(
16
-			array(
17
-				'JAN',
18
-				'FEB',
19
-				'MAR',
20
-				'APR',
21
-				'MAY',
22
-				'JUN',
23
-				'JUL',
24
-				'AUG',
25
-				'SEP',
26
-				'OCT',
27
-				'NOV',
28
-				'DEC',
29
-			),
30
-			range( 1, 12 ),
31
-			$value
32
-		);
10
+    /**
11
+     * {@inheritdoc}
12
+     */
13
+    public function isSatisfiedBy( DateTime $date, $value ) {
14
+        // Convert text month values to integers
15
+        $value = str_ireplace(
16
+            array(
17
+                'JAN',
18
+                'FEB',
19
+                'MAR',
20
+                'APR',
21
+                'MAY',
22
+                'JUN',
23
+                'JUL',
24
+                'AUG',
25
+                'SEP',
26
+                'OCT',
27
+                'NOV',
28
+                'DEC',
29
+            ),
30
+            range( 1, 12 ),
31
+            $value
32
+        );
33 33
 
34
-		return $this->isSatisfied( $date->format( 'm' ), $value );
35
-	}
34
+        return $this->isSatisfied( $date->format( 'm' ), $value );
35
+    }
36 36
 
37
-	/**
38
-	 * {@inheritdoc}
39
-	 */
40
-	public function increment( DateTime $date, $invert = false ) {
41
-		if ( $invert ) {
42
-			// $date->modify('last day of previous month'); // remove for php 5.2 compat
43
-			$date->modify( 'previous month' );
44
-			$date->modify( $date->format( 'Y-m-t' ) );
45
-			$date->setTime( 23, 59 );
46
-		} else {
47
-			// $date->modify('first day of next month'); // remove for php 5.2 compat
48
-			$date->modify( 'next month' );
49
-			$date->modify( $date->format( 'Y-m-01' ) );
50
-			$date->setTime( 0, 0 );
51
-		}
37
+    /**
38
+     * {@inheritdoc}
39
+     */
40
+    public function increment( DateTime $date, $invert = false ) {
41
+        if ( $invert ) {
42
+            // $date->modify('last day of previous month'); // remove for php 5.2 compat
43
+            $date->modify( 'previous month' );
44
+            $date->modify( $date->format( 'Y-m-t' ) );
45
+            $date->setTime( 23, 59 );
46
+        } else {
47
+            // $date->modify('first day of next month'); // remove for php 5.2 compat
48
+            $date->modify( 'next month' );
49
+            $date->modify( $date->format( 'Y-m-01' ) );
50
+            $date->setTime( 0, 0 );
51
+        }
52 52
 
53
-		return $this;
54
-	}
53
+        return $this;
54
+    }
55 55
 
56
-	/**
57
-	 * {@inheritdoc}
58
-	 */
59
-	public function validate( $value ) {
60
-		return (bool) preg_match( '/[\*,\/\-0-9A-Z]+/', $value );
61
-	}
56
+    /**
57
+     * {@inheritdoc}
58
+     */
59
+    public function validate( $value ) {
60
+        return (bool) preg_match( '/[\*,\/\-0-9A-Z]+/', $value );
61
+    }
62 62
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	/**
11 11
 	 * {@inheritdoc}
12 12
 	 */
13
-	public function isSatisfiedBy( DateTime $date, $value ) {
13
+	public function isSatisfiedBy(DateTime $date, $value) {
14 14
 		// Convert text month values to integers
15 15
 		$value = str_ireplace(
16 16
 			array(
@@ -27,27 +27,27 @@  discard block
 block discarded – undo
27 27
 				'NOV',
28 28
 				'DEC',
29 29
 			),
30
-			range( 1, 12 ),
30
+			range(1, 12),
31 31
 			$value
32 32
 		);
33 33
 
34
-		return $this->isSatisfied( $date->format( 'm' ), $value );
34
+		return $this->isSatisfied($date->format('m'), $value);
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * {@inheritdoc}
39 39
 	 */
40
-	public function increment( DateTime $date, $invert = false ) {
41
-		if ( $invert ) {
40
+	public function increment(DateTime $date, $invert = false) {
41
+		if ($invert) {
42 42
 			// $date->modify('last day of previous month'); // remove for php 5.2 compat
43
-			$date->modify( 'previous month' );
44
-			$date->modify( $date->format( 'Y-m-t' ) );
45
-			$date->setTime( 23, 59 );
43
+			$date->modify('previous month');
44
+			$date->modify($date->format('Y-m-t'));
45
+			$date->setTime(23, 59);
46 46
 		} else {
47 47
 			// $date->modify('first day of next month'); // remove for php 5.2 compat
48
-			$date->modify( 'next month' );
49
-			$date->modify( $date->format( 'Y-m-01' ) );
50
-			$date->setTime( 0, 0 );
48
+			$date->modify('next month');
49
+			$date->modify($date->format('Y-m-01'));
50
+			$date->setTime(0, 0);
51 51
 		}
52 52
 
53 53
 		return $this;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * {@inheritdoc}
58 58
 	 */
59
-	public function validate( $value ) {
60
-		return (bool) preg_match( '/[\*,\/\-0-9A-Z]+/', $value );
59
+	public function validate($value) {
60
+		return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value);
61 61
 	}
62 62
 }
Please login to merge, or discard this patch.
action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@
 block discarded – undo
7 7
  */
8 8
 interface CronExpression_FieldInterface {
9 9
 
10
-	/**
11
-	 * Check if the respective value of a DateTime field satisfies a CRON exp
12
-	 *
13
-	 * @param DateTime $date  DateTime object to check
14
-	 * @param string   $value CRON expression to test against
15
-	 *
16
-	 * @return bool Returns TRUE if satisfied, FALSE otherwise
17
-	 */
18
-	public function isSatisfiedBy( DateTime $date, $value);
10
+    /**
11
+     * Check if the respective value of a DateTime field satisfies a CRON exp
12
+     *
13
+     * @param DateTime $date  DateTime object to check
14
+     * @param string   $value CRON expression to test against
15
+     *
16
+     * @return bool Returns TRUE if satisfied, FALSE otherwise
17
+     */
18
+    public function isSatisfiedBy( DateTime $date, $value);
19 19
 
20
-	/**
21
-	 * When a CRON expression is not satisfied, this method is used to increment
22
-	 * or decrement a DateTime object by the unit of the cron field
23
-	 *
24
-	 * @param DateTime $date   DateTime object to change
25
-	 * @param bool     $invert (optional) Set to TRUE to decrement
26
-	 *
27
-	 * @return CronExpression_FieldInterface
28
-	 */
29
-	public function increment( DateTime $date, $invert = false);
20
+    /**
21
+     * When a CRON expression is not satisfied, this method is used to increment
22
+     * or decrement a DateTime object by the unit of the cron field
23
+     *
24
+     * @param DateTime $date   DateTime object to change
25
+     * @param bool     $invert (optional) Set to TRUE to decrement
26
+     *
27
+     * @return CronExpression_FieldInterface
28
+     */
29
+    public function increment( DateTime $date, $invert = false);
30 30
 
31
-	/**
32
-	 * Validates a CRON expression for a given field
33
-	 *
34
-	 * @param string $value CRON expression value to validate
35
-	 *
36
-	 * @return bool Returns TRUE if valid, FALSE otherwise
37
-	 */
38
-	public function validate( $value);
31
+    /**
32
+     * Validates a CRON expression for a given field
33
+     *
34
+     * @param string $value CRON expression value to validate
35
+     *
36
+     * @return bool Returns TRUE if valid, FALSE otherwise
37
+     */
38
+    public function validate( $value);
39 39
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return bool Returns TRUE if satisfied, FALSE otherwise
17 17
 	 */
18
-	public function isSatisfiedBy( DateTime $date, $value);
18
+	public function isSatisfiedBy(DateTime $date, $value);
19 19
 
20 20
 	/**
21 21
 	 * When a CRON expression is not satisfied, this method is used to increment
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @return CronExpression_FieldInterface
28 28
 	 */
29
-	public function increment( DateTime $date, $invert = false);
29
+	public function increment(DateTime $date, $invert = false);
30 30
 
31 31
 	/**
32 32
 	 * Validates a CRON expression for a given field
@@ -35,5 +35,5 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return bool Returns TRUE if valid, FALSE otherwise
37 37
 	 */
38
-	public function validate( $value);
38
+	public function validate($value);
39 39
 }
Please login to merge, or discard this patch.
action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -8,47 +8,47 @@
 block discarded – undo
8 8
  */
9 9
 class CronExpression_FieldFactory {
10 10
 
11
-	/**
12
-	 * @var array Cache of instantiated fields
13
-	 */
14
-	private $fields = array();
11
+    /**
12
+     * @var array Cache of instantiated fields
13
+     */
14
+    private $fields = array();
15 15
 
16
-	/**
17
-	 * Get an instance of a field object for a cron expression position
18
-	 *
19
-	 * @param int $position CRON expression position value to retrieve
20
-	 *
21
-	 * @return CronExpression_FieldInterface
22
-	 * @throws InvalidArgumentException if a position is not valid
23
-	 */
24
-	public function getField( $position ) {
25
-		if ( ! isset( $this->fields[ $position ] ) ) {
26
-			switch ( $position ) {
27
-				case 0:
28
-					$this->fields[ $position ] = new CronExpression_MinutesField();
29
-					break;
30
-				case 1:
31
-					$this->fields[ $position ] = new CronExpression_HoursField();
32
-					break;
33
-				case 2:
34
-					$this->fields[ $position ] = new CronExpression_DayOfMonthField();
35
-					break;
36
-				case 3:
37
-					$this->fields[ $position ] = new CronExpression_MonthField();
38
-					break;
39
-				case 4:
40
-					$this->fields[ $position ] = new CronExpression_DayOfWeekField();
41
-					break;
42
-				case 5:
43
-					$this->fields[ $position ] = new CronExpression_YearField();
44
-					break;
45
-				default:
46
-					throw new InvalidArgumentException(
47
-						$position . ' is not a valid position'
48
-					);
49
-			}
50
-		}
16
+    /**
17
+     * Get an instance of a field object for a cron expression position
18
+     *
19
+     * @param int $position CRON expression position value to retrieve
20
+     *
21
+     * @return CronExpression_FieldInterface
22
+     * @throws InvalidArgumentException if a position is not valid
23
+     */
24
+    public function getField( $position ) {
25
+        if ( ! isset( $this->fields[ $position ] ) ) {
26
+            switch ( $position ) {
27
+                case 0:
28
+                    $this->fields[ $position ] = new CronExpression_MinutesField();
29
+                    break;
30
+                case 1:
31
+                    $this->fields[ $position ] = new CronExpression_HoursField();
32
+                    break;
33
+                case 2:
34
+                    $this->fields[ $position ] = new CronExpression_DayOfMonthField();
35
+                    break;
36
+                case 3:
37
+                    $this->fields[ $position ] = new CronExpression_MonthField();
38
+                    break;
39
+                case 4:
40
+                    $this->fields[ $position ] = new CronExpression_DayOfWeekField();
41
+                    break;
42
+                case 5:
43
+                    $this->fields[ $position ] = new CronExpression_YearField();
44
+                    break;
45
+                default:
46
+                    throw new InvalidArgumentException(
47
+                        $position . ' is not a valid position'
48
+                    );
49
+            }
50
+        }
51 51
 
52
-		return $this->fields[ $position ];
53
-	}
52
+        return $this->fields[ $position ];
53
+    }
54 54
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,34 +21,34 @@
 block discarded – undo
21 21
 	 * @return CronExpression_FieldInterface
22 22
 	 * @throws InvalidArgumentException if a position is not valid
23 23
 	 */
24
-	public function getField( $position ) {
25
-		if ( ! isset( $this->fields[ $position ] ) ) {
26
-			switch ( $position ) {
24
+	public function getField($position) {
25
+		if ( ! isset($this->fields[$position])) {
26
+			switch ($position) {
27 27
 				case 0:
28
-					$this->fields[ $position ] = new CronExpression_MinutesField();
28
+					$this->fields[$position] = new CronExpression_MinutesField();
29 29
 					break;
30 30
 				case 1:
31
-					$this->fields[ $position ] = new CronExpression_HoursField();
31
+					$this->fields[$position] = new CronExpression_HoursField();
32 32
 					break;
33 33
 				case 2:
34
-					$this->fields[ $position ] = new CronExpression_DayOfMonthField();
34
+					$this->fields[$position] = new CronExpression_DayOfMonthField();
35 35
 					break;
36 36
 				case 3:
37
-					$this->fields[ $position ] = new CronExpression_MonthField();
37
+					$this->fields[$position] = new CronExpression_MonthField();
38 38
 					break;
39 39
 				case 4:
40
-					$this->fields[ $position ] = new CronExpression_DayOfWeekField();
40
+					$this->fields[$position] = new CronExpression_DayOfWeekField();
41 41
 					break;
42 42
 				case 5:
43
-					$this->fields[ $position ] = new CronExpression_YearField();
43
+					$this->fields[$position] = new CronExpression_YearField();
44 44
 					break;
45 45
 				default:
46 46
 					throw new InvalidArgumentException(
47
-						$position . ' is not a valid position'
47
+						$position.' is not a valid position'
48 48
 					);
49 49
 			}
50 50
 		}
51 51
 
52
-		return $this->fields[ $position ];
52
+		return $this->fields[$position];
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
src/libraries/action-scheduler/lib/cron-expression/CronExpression.php 2 patches
Indentation   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -15,293 +15,293 @@
 block discarded – undo
15 15
  */
16 16
 class CronExpression {
17 17
 
18
-	const MINUTE  = 0;
19
-	const HOUR    = 1;
20
-	const DAY     = 2;
21
-	const MONTH   = 3;
22
-	const WEEKDAY = 4;
23
-	const YEAR    = 5;
24
-
25
-	/**
26
-	 * @var array CRON expression parts
27
-	 */
28
-	private $cronParts;
29
-
30
-	/**
31
-	 * @var CronExpression_FieldFactory CRON field factory
32
-	 */
33
-	private $fieldFactory;
34
-
35
-	/**
36
-	 * @var array Order in which to test of cron parts
37
-	 */
38
-	private static $order = array( self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE );
39
-
40
-	/**
41
-	 * Factory method to create a new CronExpression.
42
-	 *
43
-	 * @param string                      $expression The CRON expression to create.  There are
44
-	 *                           several special predefined values which can be used to substitute the
45
-	 *                           CRON expression:
46
-	 *
47
-	 *      @yearly, @annually) - Run once a year, midnight, Jan. 1 - 0 0 1 1 *
48
-	 *      @monthly - Run once a month, midnight, first of month - 0 0 1 * *
49
-	 *      @weekly - Run once a week, midnight on Sun - 0 0 * * 0
50
-	 *      @daily - Run once a day, midnight - 0 0 * * *
51
-	 *      @hourly - Run once an hour, first minute - 0 * * * *
52
-	 *
53
-	 * @param CronExpression_FieldFactory $fieldFactory (optional) Field factory to use
54
-	 *
55
-	 * @return CronExpression
56
-	 */
57
-	public static function factory( $expression, CronExpression_FieldFactory $fieldFactory = null ) {
58
-		$mappings = array(
59
-			'@yearly'   => '0 0 1 1 *',
60
-			'@annually' => '0 0 1 1 *',
61
-			'@monthly'  => '0 0 1 * *',
62
-			'@weekly'   => '0 0 * * 0',
63
-			'@daily'    => '0 0 * * *',
64
-			'@hourly'   => '0 * * * *',
65
-		);
66
-
67
-		if ( isset( $mappings[ $expression ] ) ) {
68
-			$expression = $mappings[ $expression ];
69
-		}
70
-
71
-		return new self( $expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory() );
72
-	}
73
-
74
-	/**
75
-	 * Parse a CRON expression
76
-	 *
77
-	 * @param string                      $expression   CRON expression (e.g. '8 * * * *')
78
-	 * @param CronExpression_FieldFactory $fieldFactory Factory to create cron fields
79
-	 */
80
-	public function __construct( $expression, CronExpression_FieldFactory $fieldFactory ) {
81
-		$this->fieldFactory = $fieldFactory;
82
-		$this->setExpression( $expression );
83
-	}
84
-
85
-	/**
86
-	 * Set or change the CRON expression
87
-	 *
88
-	 * @param string $value CRON expression (e.g. 8 * * * *)
89
-	 *
90
-	 * @return CronExpression
91
-	 * @throws InvalidArgumentException if not a valid CRON expression
92
-	 */
93
-	public function setExpression( $value ) {
94
-		$this->cronParts = preg_split( '/\s/', $value, -1, PREG_SPLIT_NO_EMPTY );
95
-		if ( count( $this->cronParts ) < 5 ) {
96
-			throw new InvalidArgumentException(
97
-				$value . ' is not a valid CRON expression'
98
-			);
99
-		}
100
-
101
-		foreach ( $this->cronParts as $position => $part ) {
102
-			$this->setPart( $position, $part );
103
-		}
104
-
105
-		return $this;
106
-	}
107
-
108
-	/**
109
-	 * Set part of the CRON expression
110
-	 *
111
-	 * @param int    $position The position of the CRON expression to set
112
-	 * @param string $value    The value to set
113
-	 *
114
-	 * @return CronExpression
115
-	 * @throws InvalidArgumentException if the value is not valid for the part
116
-	 */
117
-	public function setPart( $position, $value ) {
118
-		if ( ! $this->fieldFactory->getField( $position )->validate( $value ) ) {
119
-			throw new InvalidArgumentException(
120
-				'Invalid CRON field value ' . $value . ' as position ' . $position
121
-			);
122
-		}
123
-
124
-		$this->cronParts[ $position ] = $value;
125
-
126
-		return $this;
127
-	}
128
-
129
-	/**
130
-	 * Get a next run date relative to the current date or a specific date
131
-	 *
132
-	 * @param string|DateTime $currentTime (optional) Relative calculation date
133
-	 * @param int             $nth         (optional) Number of matches to skip before returning a
134
-	 *     matching next run date.  0, the default, will return the current
135
-	 *     date and time if the next run date falls on the current date and
136
-	 *     time.  Setting this value to 1 will skip the first match and go to
137
-	 *     the second match.  Setting this value to 2 will skip the first 2
138
-	 *     matches and so on.
139
-	 * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
140
-	 *                current date if it matches the cron expression
141
-	 *
142
-	 * @return DateTime
143
-	 * @throws RuntimeException on too many iterations
144
-	 */
145
-	public function getNextRunDate( $currentTime = 'now', $nth = 0, $allowCurrentDate = false ) {
146
-		return $this->getRunDate( $currentTime, $nth, false, $allowCurrentDate );
147
-	}
148
-
149
-	/**
150
-	 * Get a previous run date relative to the current date or a specific date
151
-	 *
152
-	 * @param string|DateTime $currentTime      (optional) Relative calculation date
153
-	 * @param int             $nth              (optional) Number of matches to skip before returning
154
-	 * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
155
-	 *     current date if it matches the cron expression
156
-	 *
157
-	 * @return DateTime
158
-	 * @throws RuntimeException on too many iterations
159
-	 * @see CronExpression::getNextRunDate
160
-	 */
161
-	public function getPreviousRunDate( $currentTime = 'now', $nth = 0, $allowCurrentDate = false ) {
162
-		return $this->getRunDate( $currentTime, $nth, true, $allowCurrentDate );
163
-	}
164
-
165
-	/**
166
-	 * Get multiple run dates starting at the current date or a specific date
167
-	 *
168
-	 * @param int             $total            Set the total number of dates to calculate
169
-	 * @param string|DateTime $currentTime      (optional) Relative calculation date
170
-	 * @param bool            $invert           (optional) Set to TRUE to retrieve previous dates
171
-	 * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
172
-	 *     current date if it matches the cron expression
173
-	 *
174
-	 * @return array Returns an array of run dates
175
-	 */
176
-	public function getMultipleRunDates( $total, $currentTime = 'now', $invert = false, $allowCurrentDate = false ) {
177
-		$matches = array();
178
-		for ( $i = 0; $i < max( 0, $total ); $i++ ) {
179
-			$matches[] = $this->getRunDate( $currentTime, $i, $invert, $allowCurrentDate );
180
-		}
181
-
182
-		return $matches;
183
-	}
184
-
185
-	/**
186
-	 * Get all or part of the CRON expression
187
-	 *
188
-	 * @param string $part (optional) Specify the part to retrieve or NULL to
189
-	 *      get the full cron schedule string.
190
-	 *
191
-	 * @return string|null Returns the CRON expression, a part of the
192
-	 *      CRON expression, or NULL if the part was specified but not found
193
-	 */
194
-	public function getExpression( $part = null ) {
195
-		if ( null === $part ) {
196
-			return implode( ' ', $this->cronParts );
197
-		} elseif ( array_key_exists( $part, $this->cronParts ) ) {
198
-			return $this->cronParts[ $part ];
199
-		}
200
-
201
-		return null;
202
-	}
203
-
204
-	/**
205
-	 * Helper method to output the full expression.
206
-	 *
207
-	 * @return string Full CRON expression
208
-	 */
209
-	public function __toString() {
210
-		return $this->getExpression();
211
-	}
212
-
213
-	/**
214
-	 * Determine if the cron is due to run based on the current date or a
215
-	 * specific date.  This method assumes that the current number of
216
-	 * seconds are irrelevant, and should be called once per minute.
217
-	 *
218
-	 * @param string|DateTime $currentTime (optional) Relative calculation date
219
-	 *
220
-	 * @return bool Returns TRUE if the cron is due to run or FALSE if not
221
-	 */
222
-	public function isDue( $currentTime = 'now' ) {
223
-		if ( 'now' === $currentTime ) {
224
-			$currentDate = date( 'Y-m-d H:i' );
225
-			$currentTime = strtotime( $currentDate );
226
-		} elseif ( $currentTime instanceof DateTime ) {
227
-			$currentDate = $currentTime->format( 'Y-m-d H:i' );
228
-			$currentTime = strtotime( $currentDate );
229
-		} else {
230
-			$currentTime = new DateTime( $currentTime );
231
-			$currentTime->setTime( $currentTime->format( 'H' ), $currentTime->format( 'i' ), 0 );
232
-			$currentDate = $currentTime->format( 'Y-m-d H:i' );
233
-			$currentTime = (int) ( $currentTime->getTimestamp() );
234
-		}
235
-
236
-		return $this->getNextRunDate( $currentDate, 0, true )->getTimestamp() == $currentTime;
237
-	}
238
-
239
-	/**
240
-	 * Get the next or previous run date of the expression relative to a date
241
-	 *
242
-	 * @param string|DateTime $currentTime      (optional) Relative calculation date
243
-	 * @param int             $nth              (optional) Number of matches to skip before returning
244
-	 * @param bool            $invert           (optional) Set to TRUE to go backwards in time
245
-	 * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
246
-	 *     current date if it matches the cron expression
247
-	 *
248
-	 * @return DateTime
249
-	 * @throws RuntimeException on too many iterations
250
-	 */
251
-	protected function getRunDate( $currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false ) {
252
-		if ( $currentTime instanceof DateTime ) {
253
-			$currentDate = $currentTime;
254
-		} else {
255
-			$currentDate = new DateTime( $currentTime ? $currentTime : 'now' );
256
-			$currentDate->setTimezone( new DateTimeZone( date_default_timezone_get() ) );
257
-		}
258
-
259
-		$currentDate->setTime( $currentDate->format( 'H' ), $currentDate->format( 'i' ), 0 );
260
-		$nextRun = clone $currentDate;
261
-		$nth     = (int) $nth;
262
-
263
-		// Set a hard limit to bail on an impossible date
264
-		for ( $i = 0; $i < 1000; $i++ ) {
265
-
266
-			foreach ( self::$order as $position ) {
267
-				$part = $this->getExpression( $position );
268
-				if ( null === $part ) {
269
-					continue;
270
-				}
271
-
272
-				$satisfied = false;
273
-				// Get the field object used to validate this part
274
-				$field = $this->fieldFactory->getField( $position );
275
-				// Check if this is singular or a list
276
-				if ( strpos( $part, ',' ) === false ) {
277
-					$satisfied = $field->isSatisfiedBy( $nextRun, $part );
278
-				} else {
279
-					foreach ( array_map( 'trim', explode( ',', $part ) ) as $listPart ) {
280
-						if ( $field->isSatisfiedBy( $nextRun, $listPart ) ) {
281
-							$satisfied = true;
282
-							break;
283
-						}
284
-					}
285
-				}
286
-
287
-				// If the field is not satisfied, then start over
288
-				if ( ! $satisfied ) {
289
-					$field->increment( $nextRun, $invert );
290
-					continue 2;
291
-				}
292
-			}
293
-
294
-			// Skip this match if needed
295
-			if ( ( ! $allowCurrentDate && $nextRun == $currentDate ) || --$nth > -1 ) {
296
-				$this->fieldFactory->getField( 0 )->increment( $nextRun, $invert );
297
-				continue;
298
-			}
299
-
300
-			return $nextRun;
301
-		}
302
-
303
-		// @codeCoverageIgnoreStart
304
-		throw new RuntimeException( 'Impossible CRON expression' );
305
-		// @codeCoverageIgnoreEnd
306
-	}
18
+    const MINUTE  = 0;
19
+    const HOUR    = 1;
20
+    const DAY     = 2;
21
+    const MONTH   = 3;
22
+    const WEEKDAY = 4;
23
+    const YEAR    = 5;
24
+
25
+    /**
26
+     * @var array CRON expression parts
27
+     */
28
+    private $cronParts;
29
+
30
+    /**
31
+     * @var CronExpression_FieldFactory CRON field factory
32
+     */
33
+    private $fieldFactory;
34
+
35
+    /**
36
+     * @var array Order in which to test of cron parts
37
+     */
38
+    private static $order = array( self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE );
39
+
40
+    /**
41
+     * Factory method to create a new CronExpression.
42
+     *
43
+     * @param string                      $expression The CRON expression to create.  There are
44
+     *                           several special predefined values which can be used to substitute the
45
+     *                           CRON expression:
46
+     *
47
+     *      @yearly, @annually) - Run once a year, midnight, Jan. 1 - 0 0 1 1 *
48
+     *      @monthly - Run once a month, midnight, first of month - 0 0 1 * *
49
+     *      @weekly - Run once a week, midnight on Sun - 0 0 * * 0
50
+     *      @daily - Run once a day, midnight - 0 0 * * *
51
+     *      @hourly - Run once an hour, first minute - 0 * * * *
52
+     *
53
+     * @param CronExpression_FieldFactory $fieldFactory (optional) Field factory to use
54
+     *
55
+     * @return CronExpression
56
+     */
57
+    public static function factory( $expression, CronExpression_FieldFactory $fieldFactory = null ) {
58
+        $mappings = array(
59
+            '@yearly'   => '0 0 1 1 *',
60
+            '@annually' => '0 0 1 1 *',
61
+            '@monthly'  => '0 0 1 * *',
62
+            '@weekly'   => '0 0 * * 0',
63
+            '@daily'    => '0 0 * * *',
64
+            '@hourly'   => '0 * * * *',
65
+        );
66
+
67
+        if ( isset( $mappings[ $expression ] ) ) {
68
+            $expression = $mappings[ $expression ];
69
+        }
70
+
71
+        return new self( $expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory() );
72
+    }
73
+
74
+    /**
75
+     * Parse a CRON expression
76
+     *
77
+     * @param string                      $expression   CRON expression (e.g. '8 * * * *')
78
+     * @param CronExpression_FieldFactory $fieldFactory Factory to create cron fields
79
+     */
80
+    public function __construct( $expression, CronExpression_FieldFactory $fieldFactory ) {
81
+        $this->fieldFactory = $fieldFactory;
82
+        $this->setExpression( $expression );
83
+    }
84
+
85
+    /**
86
+     * Set or change the CRON expression
87
+     *
88
+     * @param string $value CRON expression (e.g. 8 * * * *)
89
+     *
90
+     * @return CronExpression
91
+     * @throws InvalidArgumentException if not a valid CRON expression
92
+     */
93
+    public function setExpression( $value ) {
94
+        $this->cronParts = preg_split( '/\s/', $value, -1, PREG_SPLIT_NO_EMPTY );
95
+        if ( count( $this->cronParts ) < 5 ) {
96
+            throw new InvalidArgumentException(
97
+                $value . ' is not a valid CRON expression'
98
+            );
99
+        }
100
+
101
+        foreach ( $this->cronParts as $position => $part ) {
102
+            $this->setPart( $position, $part );
103
+        }
104
+
105
+        return $this;
106
+    }
107
+
108
+    /**
109
+     * Set part of the CRON expression
110
+     *
111
+     * @param int    $position The position of the CRON expression to set
112
+     * @param string $value    The value to set
113
+     *
114
+     * @return CronExpression
115
+     * @throws InvalidArgumentException if the value is not valid for the part
116
+     */
117
+    public function setPart( $position, $value ) {
118
+        if ( ! $this->fieldFactory->getField( $position )->validate( $value ) ) {
119
+            throw new InvalidArgumentException(
120
+                'Invalid CRON field value ' . $value . ' as position ' . $position
121
+            );
122
+        }
123
+
124
+        $this->cronParts[ $position ] = $value;
125
+
126
+        return $this;
127
+    }
128
+
129
+    /**
130
+     * Get a next run date relative to the current date or a specific date
131
+     *
132
+     * @param string|DateTime $currentTime (optional) Relative calculation date
133
+     * @param int             $nth         (optional) Number of matches to skip before returning a
134
+     *     matching next run date.  0, the default, will return the current
135
+     *     date and time if the next run date falls on the current date and
136
+     *     time.  Setting this value to 1 will skip the first match and go to
137
+     *     the second match.  Setting this value to 2 will skip the first 2
138
+     *     matches and so on.
139
+     * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
140
+     *                current date if it matches the cron expression
141
+     *
142
+     * @return DateTime
143
+     * @throws RuntimeException on too many iterations
144
+     */
145
+    public function getNextRunDate( $currentTime = 'now', $nth = 0, $allowCurrentDate = false ) {
146
+        return $this->getRunDate( $currentTime, $nth, false, $allowCurrentDate );
147
+    }
148
+
149
+    /**
150
+     * Get a previous run date relative to the current date or a specific date
151
+     *
152
+     * @param string|DateTime $currentTime      (optional) Relative calculation date
153
+     * @param int             $nth              (optional) Number of matches to skip before returning
154
+     * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
155
+     *     current date if it matches the cron expression
156
+     *
157
+     * @return DateTime
158
+     * @throws RuntimeException on too many iterations
159
+     * @see CronExpression::getNextRunDate
160
+     */
161
+    public function getPreviousRunDate( $currentTime = 'now', $nth = 0, $allowCurrentDate = false ) {
162
+        return $this->getRunDate( $currentTime, $nth, true, $allowCurrentDate );
163
+    }
164
+
165
+    /**
166
+     * Get multiple run dates starting at the current date or a specific date
167
+     *
168
+     * @param int             $total            Set the total number of dates to calculate
169
+     * @param string|DateTime $currentTime      (optional) Relative calculation date
170
+     * @param bool            $invert           (optional) Set to TRUE to retrieve previous dates
171
+     * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
172
+     *     current date if it matches the cron expression
173
+     *
174
+     * @return array Returns an array of run dates
175
+     */
176
+    public function getMultipleRunDates( $total, $currentTime = 'now', $invert = false, $allowCurrentDate = false ) {
177
+        $matches = array();
178
+        for ( $i = 0; $i < max( 0, $total ); $i++ ) {
179
+            $matches[] = $this->getRunDate( $currentTime, $i, $invert, $allowCurrentDate );
180
+        }
181
+
182
+        return $matches;
183
+    }
184
+
185
+    /**
186
+     * Get all or part of the CRON expression
187
+     *
188
+     * @param string $part (optional) Specify the part to retrieve or NULL to
189
+     *      get the full cron schedule string.
190
+     *
191
+     * @return string|null Returns the CRON expression, a part of the
192
+     *      CRON expression, or NULL if the part was specified but not found
193
+     */
194
+    public function getExpression( $part = null ) {
195
+        if ( null === $part ) {
196
+            return implode( ' ', $this->cronParts );
197
+        } elseif ( array_key_exists( $part, $this->cronParts ) ) {
198
+            return $this->cronParts[ $part ];
199
+        }
200
+
201
+        return null;
202
+    }
203
+
204
+    /**
205
+     * Helper method to output the full expression.
206
+     *
207
+     * @return string Full CRON expression
208
+     */
209
+    public function __toString() {
210
+        return $this->getExpression();
211
+    }
212
+
213
+    /**
214
+     * Determine if the cron is due to run based on the current date or a
215
+     * specific date.  This method assumes that the current number of
216
+     * seconds are irrelevant, and should be called once per minute.
217
+     *
218
+     * @param string|DateTime $currentTime (optional) Relative calculation date
219
+     *
220
+     * @return bool Returns TRUE if the cron is due to run or FALSE if not
221
+     */
222
+    public function isDue( $currentTime = 'now' ) {
223
+        if ( 'now' === $currentTime ) {
224
+            $currentDate = date( 'Y-m-d H:i' );
225
+            $currentTime = strtotime( $currentDate );
226
+        } elseif ( $currentTime instanceof DateTime ) {
227
+            $currentDate = $currentTime->format( 'Y-m-d H:i' );
228
+            $currentTime = strtotime( $currentDate );
229
+        } else {
230
+            $currentTime = new DateTime( $currentTime );
231
+            $currentTime->setTime( $currentTime->format( 'H' ), $currentTime->format( 'i' ), 0 );
232
+            $currentDate = $currentTime->format( 'Y-m-d H:i' );
233
+            $currentTime = (int) ( $currentTime->getTimestamp() );
234
+        }
235
+
236
+        return $this->getNextRunDate( $currentDate, 0, true )->getTimestamp() == $currentTime;
237
+    }
238
+
239
+    /**
240
+     * Get the next or previous run date of the expression relative to a date
241
+     *
242
+     * @param string|DateTime $currentTime      (optional) Relative calculation date
243
+     * @param int             $nth              (optional) Number of matches to skip before returning
244
+     * @param bool            $invert           (optional) Set to TRUE to go backwards in time
245
+     * @param bool            $allowCurrentDate (optional) Set to TRUE to return the
246
+     *     current date if it matches the cron expression
247
+     *
248
+     * @return DateTime
249
+     * @throws RuntimeException on too many iterations
250
+     */
251
+    protected function getRunDate( $currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false ) {
252
+        if ( $currentTime instanceof DateTime ) {
253
+            $currentDate = $currentTime;
254
+        } else {
255
+            $currentDate = new DateTime( $currentTime ? $currentTime : 'now' );
256
+            $currentDate->setTimezone( new DateTimeZone( date_default_timezone_get() ) );
257
+        }
258
+
259
+        $currentDate->setTime( $currentDate->format( 'H' ), $currentDate->format( 'i' ), 0 );
260
+        $nextRun = clone $currentDate;
261
+        $nth     = (int) $nth;
262
+
263
+        // Set a hard limit to bail on an impossible date
264
+        for ( $i = 0; $i < 1000; $i++ ) {
265
+
266
+            foreach ( self::$order as $position ) {
267
+                $part = $this->getExpression( $position );
268
+                if ( null === $part ) {
269
+                    continue;
270
+                }
271
+
272
+                $satisfied = false;
273
+                // Get the field object used to validate this part
274
+                $field = $this->fieldFactory->getField( $position );
275
+                // Check if this is singular or a list
276
+                if ( strpos( $part, ',' ) === false ) {
277
+                    $satisfied = $field->isSatisfiedBy( $nextRun, $part );
278
+                } else {
279
+                    foreach ( array_map( 'trim', explode( ',', $part ) ) as $listPart ) {
280
+                        if ( $field->isSatisfiedBy( $nextRun, $listPart ) ) {
281
+                            $satisfied = true;
282
+                            break;
283
+                        }
284
+                    }
285
+                }
286
+
287
+                // If the field is not satisfied, then start over
288
+                if ( ! $satisfied ) {
289
+                    $field->increment( $nextRun, $invert );
290
+                    continue 2;
291
+                }
292
+            }
293
+
294
+            // Skip this match if needed
295
+            if ( ( ! $allowCurrentDate && $nextRun == $currentDate ) || --$nth > -1 ) {
296
+                $this->fieldFactory->getField( 0 )->increment( $nextRun, $invert );
297
+                continue;
298
+            }
299
+
300
+            return $nextRun;
301
+        }
302
+
303
+        // @codeCoverageIgnoreStart
304
+        throw new RuntimeException( 'Impossible CRON expression' );
305
+        // @codeCoverageIgnoreEnd
306
+    }
307 307
 }
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * @var array Order in which to test of cron parts
37 37
 	 */
38
-	private static $order = array( self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE );
38
+	private static $order = array(self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE);
39 39
 
40 40
 	/**
41 41
 	 * Factory method to create a new CronExpression.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return CronExpression
56 56
 	 */
57
-	public static function factory( $expression, CronExpression_FieldFactory $fieldFactory = null ) {
57
+	public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null) {
58 58
 		$mappings = array(
59 59
 			'@yearly'   => '0 0 1 1 *',
60 60
 			'@annually' => '0 0 1 1 *',
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 			'@hourly'   => '0 * * * *',
65 65
 		);
66 66
 
67
-		if ( isset( $mappings[ $expression ] ) ) {
68
-			$expression = $mappings[ $expression ];
67
+		if (isset($mappings[$expression])) {
68
+			$expression = $mappings[$expression];
69 69
 		}
70 70
 
71
-		return new self( $expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory() );
71
+		return new self($expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory());
72 72
 	}
73 73
 
74 74
 	/**
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 * @param string                      $expression   CRON expression (e.g. '8 * * * *')
78 78
 	 * @param CronExpression_FieldFactory $fieldFactory Factory to create cron fields
79 79
 	 */
80
-	public function __construct( $expression, CronExpression_FieldFactory $fieldFactory ) {
80
+	public function __construct($expression, CronExpression_FieldFactory $fieldFactory) {
81 81
 		$this->fieldFactory = $fieldFactory;
82
-		$this->setExpression( $expression );
82
+		$this->setExpression($expression);
83 83
 	}
84 84
 
85 85
 	/**
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 	 * @return CronExpression
91 91
 	 * @throws InvalidArgumentException if not a valid CRON expression
92 92
 	 */
93
-	public function setExpression( $value ) {
94
-		$this->cronParts = preg_split( '/\s/', $value, -1, PREG_SPLIT_NO_EMPTY );
95
-		if ( count( $this->cronParts ) < 5 ) {
93
+	public function setExpression($value) {
94
+		$this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY);
95
+		if (count($this->cronParts) < 5) {
96 96
 			throw new InvalidArgumentException(
97
-				$value . ' is not a valid CRON expression'
97
+				$value.' is not a valid CRON expression'
98 98
 			);
99 99
 		}
100 100
 
101
-		foreach ( $this->cronParts as $position => $part ) {
102
-			$this->setPart( $position, $part );
101
+		foreach ($this->cronParts as $position => $part) {
102
+			$this->setPart($position, $part);
103 103
 		}
104 104
 
105 105
 		return $this;
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	 * @return CronExpression
115 115
 	 * @throws InvalidArgumentException if the value is not valid for the part
116 116
 	 */
117
-	public function setPart( $position, $value ) {
118
-		if ( ! $this->fieldFactory->getField( $position )->validate( $value ) ) {
117
+	public function setPart($position, $value) {
118
+		if ( ! $this->fieldFactory->getField($position)->validate($value)) {
119 119
 			throw new InvalidArgumentException(
120
-				'Invalid CRON field value ' . $value . ' as position ' . $position
120
+				'Invalid CRON field value '.$value.' as position '.$position
121 121
 			);
122 122
 		}
123 123
 
124
-		$this->cronParts[ $position ] = $value;
124
+		$this->cronParts[$position] = $value;
125 125
 
126 126
 		return $this;
127 127
 	}
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 * @return DateTime
143 143
 	 * @throws RuntimeException on too many iterations
144 144
 	 */
145
-	public function getNextRunDate( $currentTime = 'now', $nth = 0, $allowCurrentDate = false ) {
146
-		return $this->getRunDate( $currentTime, $nth, false, $allowCurrentDate );
145
+	public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) {
146
+		return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate);
147 147
 	}
148 148
 
149 149
 	/**
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @throws RuntimeException on too many iterations
159 159
 	 * @see CronExpression::getNextRunDate
160 160
 	 */
161
-	public function getPreviousRunDate( $currentTime = 'now', $nth = 0, $allowCurrentDate = false ) {
162
-		return $this->getRunDate( $currentTime, $nth, true, $allowCurrentDate );
161
+	public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) {
162
+		return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate);
163 163
 	}
164 164
 
165 165
 	/**
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return array Returns an array of run dates
175 175
 	 */
176
-	public function getMultipleRunDates( $total, $currentTime = 'now', $invert = false, $allowCurrentDate = false ) {
176
+	public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false) {
177 177
 		$matches = array();
178
-		for ( $i = 0; $i < max( 0, $total ); $i++ ) {
179
-			$matches[] = $this->getRunDate( $currentTime, $i, $invert, $allowCurrentDate );
178
+		for ($i = 0; $i < max(0, $total); $i++) {
179
+			$matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate);
180 180
 		}
181 181
 
182 182
 		return $matches;
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	 * @return string|null Returns the CRON expression, a part of the
192 192
 	 *      CRON expression, or NULL if the part was specified but not found
193 193
 	 */
194
-	public function getExpression( $part = null ) {
195
-		if ( null === $part ) {
196
-			return implode( ' ', $this->cronParts );
197
-		} elseif ( array_key_exists( $part, $this->cronParts ) ) {
198
-			return $this->cronParts[ $part ];
194
+	public function getExpression($part = null) {
195
+		if (null === $part) {
196
+			return implode(' ', $this->cronParts);
197
+		} elseif (array_key_exists($part, $this->cronParts)) {
198
+			return $this->cronParts[$part];
199 199
 		}
200 200
 
201 201
 		return null;
@@ -219,21 +219,21 @@  discard block
 block discarded – undo
219 219
 	 *
220 220
 	 * @return bool Returns TRUE if the cron is due to run or FALSE if not
221 221
 	 */
222
-	public function isDue( $currentTime = 'now' ) {
223
-		if ( 'now' === $currentTime ) {
224
-			$currentDate = date( 'Y-m-d H:i' );
225
-			$currentTime = strtotime( $currentDate );
226
-		} elseif ( $currentTime instanceof DateTime ) {
227
-			$currentDate = $currentTime->format( 'Y-m-d H:i' );
228
-			$currentTime = strtotime( $currentDate );
222
+	public function isDue($currentTime = 'now') {
223
+		if ('now' === $currentTime) {
224
+			$currentDate = date('Y-m-d H:i');
225
+			$currentTime = strtotime($currentDate);
226
+		} elseif ($currentTime instanceof DateTime) {
227
+			$currentDate = $currentTime->format('Y-m-d H:i');
228
+			$currentTime = strtotime($currentDate);
229 229
 		} else {
230
-			$currentTime = new DateTime( $currentTime );
231
-			$currentTime->setTime( $currentTime->format( 'H' ), $currentTime->format( 'i' ), 0 );
232
-			$currentDate = $currentTime->format( 'Y-m-d H:i' );
233
-			$currentTime = (int) ( $currentTime->getTimestamp() );
230
+			$currentTime = new DateTime($currentTime);
231
+			$currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0);
232
+			$currentDate = $currentTime->format('Y-m-d H:i');
233
+			$currentTime = (int) ($currentTime->getTimestamp());
234 234
 		}
235 235
 
236
-		return $this->getNextRunDate( $currentDate, 0, true )->getTimestamp() == $currentTime;
236
+		return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime;
237 237
 	}
238 238
 
239 239
 	/**
@@ -248,36 +248,36 @@  discard block
 block discarded – undo
248 248
 	 * @return DateTime
249 249
 	 * @throws RuntimeException on too many iterations
250 250
 	 */
251
-	protected function getRunDate( $currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false ) {
252
-		if ( $currentTime instanceof DateTime ) {
251
+	protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false) {
252
+		if ($currentTime instanceof DateTime) {
253 253
 			$currentDate = $currentTime;
254 254
 		} else {
255
-			$currentDate = new DateTime( $currentTime ? $currentTime : 'now' );
256
-			$currentDate->setTimezone( new DateTimeZone( date_default_timezone_get() ) );
255
+			$currentDate = new DateTime($currentTime ? $currentTime : 'now');
256
+			$currentDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
257 257
 		}
258 258
 
259
-		$currentDate->setTime( $currentDate->format( 'H' ), $currentDate->format( 'i' ), 0 );
259
+		$currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0);
260 260
 		$nextRun = clone $currentDate;
261 261
 		$nth     = (int) $nth;
262 262
 
263 263
 		// Set a hard limit to bail on an impossible date
264
-		for ( $i = 0; $i < 1000; $i++ ) {
264
+		for ($i = 0; $i < 1000; $i++) {
265 265
 
266
-			foreach ( self::$order as $position ) {
267
-				$part = $this->getExpression( $position );
268
-				if ( null === $part ) {
266
+			foreach (self::$order as $position) {
267
+				$part = $this->getExpression($position);
268
+				if (null === $part) {
269 269
 					continue;
270 270
 				}
271 271
 
272 272
 				$satisfied = false;
273 273
 				// Get the field object used to validate this part
274
-				$field = $this->fieldFactory->getField( $position );
274
+				$field = $this->fieldFactory->getField($position);
275 275
 				// Check if this is singular or a list
276
-				if ( strpos( $part, ',' ) === false ) {
277
-					$satisfied = $field->isSatisfiedBy( $nextRun, $part );
276
+				if (strpos($part, ',') === false) {
277
+					$satisfied = $field->isSatisfiedBy($nextRun, $part);
278 278
 				} else {
279
-					foreach ( array_map( 'trim', explode( ',', $part ) ) as $listPart ) {
280
-						if ( $field->isSatisfiedBy( $nextRun, $listPart ) ) {
279
+					foreach (array_map('trim', explode(',', $part)) as $listPart) {
280
+						if ($field->isSatisfiedBy($nextRun, $listPart)) {
281 281
 							$satisfied = true;
282 282
 							break;
283 283
 						}
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 				}
286 286
 
287 287
 				// If the field is not satisfied, then start over
288
-				if ( ! $satisfied ) {
289
-					$field->increment( $nextRun, $invert );
288
+				if ( ! $satisfied) {
289
+					$field->increment($nextRun, $invert);
290 290
 					continue 2;
291 291
 				}
292 292
 			}
293 293
 
294 294
 			// Skip this match if needed
295
-			if ( ( ! $allowCurrentDate && $nextRun == $currentDate ) || --$nth > -1 ) {
296
-				$this->fieldFactory->getField( 0 )->increment( $nextRun, $invert );
295
+			if (( ! $allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) {
296
+				$this->fieldFactory->getField(0)->increment($nextRun, $invert);
297 297
 				continue;
298 298
 			}
299 299
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		}
302 302
 
303 303
 		// @codeCoverageIgnoreStart
304
-		throw new RuntimeException( 'Impossible CRON expression' );
304
+		throw new RuntimeException('Impossible CRON expression');
305 305
 		// @codeCoverageIgnoreEnd
306 306
 	}
307 307
 }
Please login to merge, or discard this patch.
src/libraries/action-scheduler/action-scheduler.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -28,40 +28,40 @@
 block discarded – undo
28 28
 
29 29
 if ( ! function_exists( 'action_scheduler_register_3_dot_5_dot_3' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION.
30 30
 
31
-	if ( ! class_exists( 'ActionScheduler_Versions', false ) ) {
32
-		require_once __DIR__ . '/classes/ActionScheduler_Versions.php';
33
-		add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 );
34
-	}
31
+    if ( ! class_exists( 'ActionScheduler_Versions', false ) ) {
32
+        require_once __DIR__ . '/classes/ActionScheduler_Versions.php';
33
+        add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 );
34
+    }
35 35
 
36
-	add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_5_dot_3', 0, 0 ); // WRCS: DEFINED_VERSION.
36
+    add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_5_dot_3', 0, 0 ); // WRCS: DEFINED_VERSION.
37 37
 
38
-	/**
39
-	 * Registers this version of Action Scheduler.
40
-	 */
41
-	function action_scheduler_register_3_dot_5_dot_3() {
42
-		// WRCS: DEFINED_VERSION.
43
-		$versions = ActionScheduler_Versions::instance();
44
-		$versions->register( '3.5.3', 'action_scheduler_initialize_3_dot_5_dot_3' ); // WRCS: DEFINED_VERSION.
45
-	}
38
+    /**
39
+     * Registers this version of Action Scheduler.
40
+     */
41
+    function action_scheduler_register_3_dot_5_dot_3() {
42
+        // WRCS: DEFINED_VERSION.
43
+        $versions = ActionScheduler_Versions::instance();
44
+        $versions->register( '3.5.3', 'action_scheduler_initialize_3_dot_5_dot_3' ); // WRCS: DEFINED_VERSION.
45
+    }
46 46
 
47
-	/**
48
-	 * Initializes this version of Action Scheduler.
49
-	 */
50
-	function action_scheduler_initialize_3_dot_5_dot_3() {
51
-		// WRCS: DEFINED_VERSION.
52
-		// A final safety check is required even here, because historic versions of Action Scheduler
53
-		// followed a different pattern (in some unusual cases, we could reach this point and the
54
-		// ActionScheduler class is already defined—so we need to guard against that).
55
-		if ( ! class_exists( 'ActionScheduler', false ) ) {
56
-			require_once __DIR__ . '/classes/abstracts/ActionScheduler.php';
57
-			ActionScheduler::init( __FILE__ );
58
-		}
59
-	}
47
+    /**
48
+     * Initializes this version of Action Scheduler.
49
+     */
50
+    function action_scheduler_initialize_3_dot_5_dot_3() {
51
+        // WRCS: DEFINED_VERSION.
52
+        // A final safety check is required even here, because historic versions of Action Scheduler
53
+        // followed a different pattern (in some unusual cases, we could reach this point and the
54
+        // ActionScheduler class is already defined—so we need to guard against that).
55
+        if ( ! class_exists( 'ActionScheduler', false ) ) {
56
+            require_once __DIR__ . '/classes/abstracts/ActionScheduler.php';
57
+            ActionScheduler::init( __FILE__ );
58
+        }
59
+    }
60 60
 
61
-	// Support usage in themes - load this version if no plugin has loaded a version yet.
62
-	if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) {
63
-		action_scheduler_initialize_3_dot_5_dot_3(); // WRCS: DEFINED_VERSION.
64
-		do_action( 'action_scheduler_pre_theme_init' );
65
-		ActionScheduler_Versions::initialize_latest_version();
66
-	}
61
+    // Support usage in themes - load this version if no plugin has loaded a version yet.
62
+    if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) {
63
+        action_scheduler_initialize_3_dot_5_dot_3(); // WRCS: DEFINED_VERSION.
64
+        do_action( 'action_scheduler_pre_theme_init' );
65
+        ActionScheduler_Versions::initialize_latest_version();
66
+    }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
  * @package ActionScheduler
27 27
  */
28 28
 
29
-if ( ! function_exists( 'action_scheduler_register_3_dot_5_dot_3' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION.
29
+if ( ! function_exists('action_scheduler_register_3_dot_5_dot_3') && function_exists('add_action')) { // WRCS: DEFINED_VERSION.
30 30
 
31
-	if ( ! class_exists( 'ActionScheduler_Versions', false ) ) {
32
-		require_once __DIR__ . '/classes/ActionScheduler_Versions.php';
33
-		add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 );
31
+	if ( ! class_exists('ActionScheduler_Versions', false)) {
32
+		require_once __DIR__.'/classes/ActionScheduler_Versions.php';
33
+		add_action('plugins_loaded', array('ActionScheduler_Versions', 'initialize_latest_version'), 1, 0);
34 34
 	}
35 35
 
36
-	add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_5_dot_3', 0, 0 ); // WRCS: DEFINED_VERSION.
36
+	add_action('plugins_loaded', 'action_scheduler_register_3_dot_5_dot_3', 0, 0); // WRCS: DEFINED_VERSION.
37 37
 
38 38
 	/**
39 39
 	 * Registers this version of Action Scheduler.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	function action_scheduler_register_3_dot_5_dot_3() {
42 42
 		// WRCS: DEFINED_VERSION.
43 43
 		$versions = ActionScheduler_Versions::instance();
44
-		$versions->register( '3.5.3', 'action_scheduler_initialize_3_dot_5_dot_3' ); // WRCS: DEFINED_VERSION.
44
+		$versions->register('3.5.3', 'action_scheduler_initialize_3_dot_5_dot_3'); // WRCS: DEFINED_VERSION.
45 45
 	}
46 46
 
47 47
 	/**
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 		// A final safety check is required even here, because historic versions of Action Scheduler
53 53
 		// followed a different pattern (in some unusual cases, we could reach this point and the
54 54
 		// ActionScheduler class is already defined—so we need to guard against that).
55
-		if ( ! class_exists( 'ActionScheduler', false ) ) {
56
-			require_once __DIR__ . '/classes/abstracts/ActionScheduler.php';
57
-			ActionScheduler::init( __FILE__ );
55
+		if ( ! class_exists('ActionScheduler', false)) {
56
+			require_once __DIR__.'/classes/abstracts/ActionScheduler.php';
57
+			ActionScheduler::init(__FILE__);
58 58
 		}
59 59
 	}
60 60
 
61 61
 	// Support usage in themes - load this version if no plugin has loaded a version yet.
62
-	if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) {
62
+	if (did_action('plugins_loaded') && ! doing_action('plugins_loaded') && ! class_exists('ActionScheduler', false)) {
63 63
 		action_scheduler_initialize_3_dot_5_dot_3(); // WRCS: DEFINED_VERSION.
64
-		do_action( 'action_scheduler_pre_theme_init' );
64
+		do_action('action_scheduler_pre_theme_init');
65 65
 		ActionScheduler_Versions::initialize_latest_version();
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-ui-service.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -7,110 +7,110 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_UI_Service {
9 9
 
10
-	/**
11
-	 * The button element HTML code.
12
-	 *
13
-	 * @since 3.2.0
14
-	 */
15
-	const BUTTON_HTML = '<a id="%s" class="button wl-button">%s</a>';
10
+    /**
11
+     * The button element HTML code.
12
+     *
13
+     * @since 3.2.0
14
+     */
15
+    const BUTTON_HTML = '<a id="%s" class="button wl-button">%s</a>';
16 16
 
17
-	/**
18
-	 * The template HTML code.
19
-	 *
20
-	 * @since 3.2.0
21
-	 */
22
-	const TEMPLATE_HTML = '<script id="%s" type="text/template">%s</script>';
17
+    /**
18
+     * The template HTML code.
19
+     *
20
+     * @since 3.2.0
21
+     */
22
+    const TEMPLATE_HTML = '<script id="%s" type="text/template">%s</script>';
23 23
 
24
-	/**
25
-	 * Get the button HTML.
26
-	 *
27
-	 * @param string $element_id The button element id.
28
-	 * @param string $label The button (translated) label.
29
-	 *
30
-	 * @return string The button HTML code.
31
-	 * @since 3.2.0
32
-	 */
33
-	public static function get_button_html( $element_id, $label ) {
24
+    /**
25
+     * Get the button HTML.
26
+     *
27
+     * @param string $element_id The button element id.
28
+     * @param string $label The button (translated) label.
29
+     *
30
+     * @return string The button HTML code.
31
+     * @since 3.2.0
32
+     */
33
+    public static function get_button_html( $element_id, $label ) {
34 34
 
35
-		return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
36
-	}
35
+        return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
36
+    }
37 37
 
38
-	/**
39
-	 * Echo the button HTML.
40
-	 *
41
-	 * @param string $element_id The button element id.
42
-	 * @param string $label The button (translated) label.
43
-	 *
44
-	 * @since 3.2.0
45
-	 */
46
-	public static function print_button( $element_id, $label ) {
38
+    /**
39
+     * Echo the button HTML.
40
+     *
41
+     * @param string $element_id The button element id.
42
+     * @param string $label The button (translated) label.
43
+     *
44
+     * @since 3.2.0
45
+     */
46
+    public static function print_button( $element_id, $label ) {
47 47
 
48
-		echo wp_kses(
49
-			self::get_button_html( $element_id, $label ),
50
-			array(
51
-				'a' => array(
52
-					'id'    => array(),
53
-					'class' => array(),
54
-				),
55
-			)
56
-		);
48
+        echo wp_kses(
49
+            self::get_button_html( $element_id, $label ),
50
+            array(
51
+                'a' => array(
52
+                    'id'    => array(),
53
+                    'class' => array(),
54
+                ),
55
+            )
56
+        );
57 57
 
58
-	}
58
+    }
59 59
 
60
-	/**
61
-	 * Get the HTML code for a template tag.
62
-	 *
63
-	 * @param string $element_id The element id.
64
-	 * @param string $body The element content.
65
-	 *
66
-	 * @return string The HTML code.
67
-	 * @since 3.2.0
68
-	 */
69
-	public static function get_template_html( $element_id, $body ) {
60
+    /**
61
+     * Get the HTML code for a template tag.
62
+     *
63
+     * @param string $element_id The element id.
64
+     * @param string $body The element content.
65
+     *
66
+     * @return string The HTML code.
67
+     * @since 3.2.0
68
+     */
69
+    public static function get_template_html( $element_id, $body ) {
70 70
 
71
-		return sprintf( self::TEMPLATE_HTML, $element_id, $body );
72
-	}
71
+        return sprintf( self::TEMPLATE_HTML, $element_id, $body );
72
+    }
73 73
 
74
-	/**
75
-	 * Echo the HTML code for a template tag.
76
-	 *
77
-	 * @param string $element_id The element id.
78
-	 * @param string $body The element content.
79
-	 *
80
-	 * @since 3.2.0
81
-	 */
82
-	public static function print_template( $element_id, $body ) {
74
+    /**
75
+     * Echo the HTML code for a template tag.
76
+     *
77
+     * @param string $element_id The element id.
78
+     * @param string $body The element content.
79
+     *
80
+     * @since 3.2.0
81
+     */
82
+    public static function print_template( $element_id, $body ) {
83 83
 
84
-		echo wp_kses(
85
-			self::get_template_html( $element_id, $body ),
86
-			self::get_template_allowed_html()
87
-		);
88
-	}
84
+        echo wp_kses(
85
+            self::get_template_html( $element_id, $body ),
86
+            self::get_template_allowed_html()
87
+        );
88
+    }
89 89
 
90
-	/**
91
-	 * @return array[]
92
-	 */
93
-	public static function get_template_allowed_html() {
94
-		return array(
95
-			'div'    => array( 'class' => array() ),
96
-			'label'  => array(
97
-				'class' => array(),
98
-				'id'    => array(),
99
-				'for'   => array(),
100
-			),
101
-			'input'  => array(
102
-				'name'  => array(),
103
-				'size'  => array(),
104
-				'value' => array(),
105
-				'id'    => array(),
106
-				'type'  => array(),
107
-			),
108
-			'button' => array( 'class' => array() ),
109
-			'script' => array(
110
-				'id'   => array(),
111
-				'type' => array(),
112
-			),
113
-		);
114
-	}
90
+    /**
91
+     * @return array[]
92
+     */
93
+    public static function get_template_allowed_html() {
94
+        return array(
95
+            'div'    => array( 'class' => array() ),
96
+            'label'  => array(
97
+                'class' => array(),
98
+                'id'    => array(),
99
+                'for'   => array(),
100
+            ),
101
+            'input'  => array(
102
+                'name'  => array(),
103
+                'size'  => array(),
104
+                'value' => array(),
105
+                'id'    => array(),
106
+                'type'  => array(),
107
+            ),
108
+            'button' => array( 'class' => array() ),
109
+            'script' => array(
110
+                'id'   => array(),
111
+                'type' => array(),
112
+            ),
113
+        );
114
+    }
115 115
 
116 116
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @return string The button HTML code.
31 31
 	 * @since 3.2.0
32 32
 	 */
33
-	public static function get_button_html( $element_id, $label ) {
33
+	public static function get_button_html($element_id, $label) {
34 34
 
35
-		return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) );
35
+		return sprintf(self::BUTTON_HTML, $element_id, esc_html($label));
36 36
 	}
37 37
 
38 38
 	/**
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @since 3.2.0
45 45
 	 */
46
-	public static function print_button( $element_id, $label ) {
46
+	public static function print_button($element_id, $label) {
47 47
 
48 48
 		echo wp_kses(
49
-			self::get_button_html( $element_id, $label ),
49
+			self::get_button_html($element_id, $label),
50 50
 			array(
51 51
 				'a' => array(
52 52
 					'id'    => array(),
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @return string The HTML code.
67 67
 	 * @since 3.2.0
68 68
 	 */
69
-	public static function get_template_html( $element_id, $body ) {
69
+	public static function get_template_html($element_id, $body) {
70 70
 
71
-		return sprintf( self::TEMPLATE_HTML, $element_id, $body );
71
+		return sprintf(self::TEMPLATE_HTML, $element_id, $body);
72 72
 	}
73 73
 
74 74
 	/**
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @since 3.2.0
81 81
 	 */
82
-	public static function print_template( $element_id, $body ) {
82
+	public static function print_template($element_id, $body) {
83 83
 
84 84
 		echo wp_kses(
85
-			self::get_template_html( $element_id, $body ),
85
+			self::get_template_html($element_id, $body),
86 86
 			self::get_template_allowed_html()
87 87
 		);
88 88
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public static function get_template_allowed_html() {
94 94
 		return array(
95
-			'div'    => array( 'class' => array() ),
95
+			'div'    => array('class' => array()),
96 96
 			'label'  => array(
97 97
 				'class' => array(),
98 98
 				'id'    => array(),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 				'id'    => array(),
106 106
 				'type'  => array(),
107 107
 			),
108
-			'button' => array( 'class' => array() ),
108
+			'button' => array('class' => array()),
109 109
 			'script' => array(
110 110
 				'id'   => array(),
111 111
 				'type' => array(),
Please login to merge, or discard this patch.