1 | <?php namespace Indatus\Dispatcher\Drivers\DateTime; |
||
15 | class ScheduleInterpreter |
||
16 | { |
||
17 | /** @var Carbon */ |
||
18 | protected $now; |
||
19 | |||
20 | /** @var Scheduler */ |
||
21 | protected $scheduler; |
||
22 | |||
23 | protected $month = null; |
||
24 | protected $week = null; |
||
25 | protected $dayOfMonth = null; |
||
26 | protected $dayOfWeek = null; |
||
27 | protected $hour = null; |
||
28 | protected $minute = null; |
||
29 | |||
30 | 9 | public function __construct(Scheduler $scheduler, Carbon $now) |
|
35 | |||
36 | /** |
||
37 | * Determine if the current schedule is due to be run |
||
38 | * |
||
39 | * @return bool |
||
40 | */ |
||
41 | 2 | public function isDue() |
|
53 | |||
54 | /** |
||
55 | * Determine if the provided expression refers to this week |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | 8 | public function thisWeek() |
|
79 | |||
80 | /** |
||
81 | * This method checks syntax for all scheduling components. |
||
82 | * |
||
83 | * - If there's a direct match |
||
84 | * - If it's an ANY match |
||
85 | * - If the expression exists in the series |
||
86 | * |
||
87 | * @param string $expression The expression to compare |
||
88 | * @param string $current The current value to compare against |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | 7 | protected function isCurrent($expression, $current) |
|
111 | } |
||
112 |