| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | trait IsScheduled |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Event object that is used to manages the frequency. |
||
| 13 | * |
||
| 14 | * @var \Illuminate\Console\Scheduling\Event |
||
| 15 | */ |
||
| 16 | private $event; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Returns the EventMutex bound to the container or creates a new instance. |
||
| 20 | * |
||
| 21 | * @return \Illuminate\Console\Scheduling\EventMutex |
||
| 22 | */ |
||
| 23 | private function eventMutex(): EventMutex |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Returns the Event that is used to manages the frequency. |
||
| 34 | * |
||
| 35 | * @return \Illuminate\Console\Scheduling\Event |
||
| 36 | */ |
||
| 37 | private function event(): Event |
||
| 38 | { |
||
| 39 | if (!$this->event) { |
||
| 40 | $this->event = new Event($this->eventMutex(), ''); |
||
| 41 | } |
||
| 42 | |||
| 43 | return $this->event; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Determine if the checker is due to run based on the current date. |
||
| 48 | * |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | public function isDue(): bool |
||
| 52 | { |
||
| 53 | $this->schedule($this->event()); |
||
| 54 | |||
| 55 | return $this->event->isDue(app()); |
||
|
|
|||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Defines the checker's schedule. |
||
| 60 | * |
||
| 61 | * @param \Illuminate\Console\Scheduling\Event $event |
||
| 62 | * @return void |
||
| 63 | */ |
||
| 64 | public function schedule(Event $event) |
||
| 67 | } |
||
| 68 | } |
||
| 69 |