@@ -71,14 +71,16 @@ public function __construct(
71
71
}
72
72
73
73
/**
74
- * @return void
74
+ * @inheritdoc
75
75
*/
76
76
public function _construct ()
77
77
{
78
78
$ this ->_init (\Magento \Cron \Model \ResourceModel \Schedule::class);
79
79
}
80
80
81
81
/**
82
+ * Set cron expression.
83
+ *
82
84
* @param string $expr
83
85
* @return $this
84
86
* @throws \Magento\Framework\Exception\CronException
@@ -87,15 +89,15 @@ public function setCronExpr($expr)
87
89
{
88
90
$ e = preg_split ('#\s+# ' , $ expr , null , PREG_SPLIT_NO_EMPTY );
89
91
if (sizeof ($ e ) < 5 || sizeof ($ e ) > 6 ) {
90
- throw new CronException (__ ('The "%1" cron expression is invalid. Verify and try again. ' , $ expr ));
92
+ throw new CronException (__ ('Invalid cron expression: %1 ' , $ expr ));
91
93
}
92
94
93
95
$ this ->setCronExprArr ($ e );
94
96
return $ this ;
95
97
}
96
98
97
99
/**
98
- * Checks the observer's cron expression against time
100
+ * Checks the observer's cron expression against time.
99
101
*
100
102
* Supports $this->setCronExpr('* 0-5,10-59/5 2-10,15-25 january-june/2 mon-fri')
101
103
*
@@ -125,6 +127,8 @@ public function trySchedule()
125
127
}
126
128
127
129
/**
130
+ * Match cron expression.
131
+ *
128
132
* @param string $expr
129
133
* @param int $num
130
134
* @return bool
@@ -184,13 +188,15 @@ public function matchCronExpression($expr, $num)
184
188
}
185
189
186
190
if ($ from === false || $ to === false ) {
187
- throw new CronException (__ ('The "%1" cron expression is invalid. Verify and try again. ' , $ expr ));
191
+ throw new CronException (__ ('Invalid cron expression: %1 ' , $ expr ));
188
192
}
189
193
190
194
return $ num >= $ from && $ num <= $ to && $ num % $ mod === 0 ;
191
195
}
192
196
193
197
/**
198
+ * Get number of a month.
199
+ *
194
200
* @param int|string $value
195
201
* @return bool|int|string
196
202
*/
0 commit comments