1 | <?php |
||
32 | class Cron extends AbstractScheduled |
||
33 | { |
||
34 | /** |
||
35 | * Special cron expression shorthands. |
||
36 | */ |
||
37 | const PERIOD_YEARLY = '@yearly'; |
||
38 | const PERIOD_ANNUALLY = '@annually'; |
||
39 | const PERIOD_MONTHLY = '@monthly'; |
||
40 | const PERIOD_WEEKLY = '@weekly'; |
||
41 | const PERIOD_DAILY = '@daily'; |
||
42 | const PERIOD_HOURLY = '@hourly'; |
||
43 | |||
44 | /** |
||
45 | * Mapper for especial cron expression shorthands. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $expressionMapper = [ |
||
50 | self::PERIOD_YEARLY => '0 0 1 1 *', |
||
51 | self::PERIOD_ANNUALLY => '0 0 1 1 *', |
||
52 | self::PERIOD_MONTHLY => '0 0 1 * *', |
||
53 | self::PERIOD_WEEKLY => '0 0 * * 0', |
||
54 | self::PERIOD_DAILY => '0 0 * * *', |
||
55 | self::PERIOD_HOURLY => '0 * * * *', |
||
56 | ]; |
||
57 | |||
58 | /** |
||
59 | * Cron expression handler. |
||
60 | * |
||
61 | * @var \Cron\CronExpression |
||
62 | */ |
||
63 | protected $expression; |
||
64 | |||
65 | /** |
||
66 | * Maintenance mode interval time. |
||
67 | * |
||
68 | * @var \DateInterval |
||
69 | */ |
||
70 | protected $interval; |
||
71 | |||
72 | /** |
||
73 | * Cron constructor. |
||
74 | * |
||
75 | * @param \Cron\CronExpression|string $expression |
||
76 | * @param \DateInterval|string $interval |
||
77 | * @param \DateTimeZone|string|int $timeZone |
||
|
|||
78 | * |
||
79 | * @throws \InvalidArgumentException |
||
80 | */ |
||
81 | public function __construct($expression, $interval, $timeZone = null) |
||
90 | |||
91 | /** |
||
92 | * Set cron expression. |
||
93 | * |
||
94 | * @param \Cron\CronExpression|string $expression |
||
95 | * |
||
96 | * @throws \InvalidArgumentException |
||
97 | * |
||
98 | * @return $this |
||
99 | */ |
||
100 | public function setExpression($expression) |
||
114 | |||
115 | /** |
||
116 | * Get cron expression. |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getExpression() |
||
128 | |||
129 | /** |
||
130 | * Sets a valid \DateInterval. |
||
131 | * |
||
132 | * @param \DateInterval|string $interval |
||
133 | * |
||
134 | * @throws \InvalidArgumentException |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | public function setInterval($interval) |
||
154 | |||
155 | /** |
||
156 | * Get maintenance interval. |
||
157 | * |
||
158 | * @return \DateInterval |
||
159 | */ |
||
160 | public function getInterval() |
||
164 | |||
165 | /** |
||
166 | * {@inheritdoc} |
||
167 | */ |
||
168 | public function getStart() |
||
176 | |||
177 | /** |
||
178 | * {@inheritdoc} |
||
179 | */ |
||
180 | public function getEnd() |
||
191 | |||
192 | /** |
||
193 | * {@inheritdoc} |
||
194 | */ |
||
195 | public function getScheduledTimes($count = 5) |
||
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | public function isScheduled() |
||
238 | |||
239 | /** |
||
240 | * {@inheritdoc} |
||
241 | */ |
||
242 | public function isActive() |
||
257 | } |
||
258 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.