| 1 | <?php |
||
| 11 | class Schedule |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Stack of events |
||
| 15 | * @var Event[] |
||
| 16 | */ |
||
| 17 | protected $events = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string|null |
||
| 21 | */ |
||
| 22 | protected $name; |
||
| 23 | |||
| 24 | 2 | public function __construct(/* string */ $name = null) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Get the name of this schedule |
||
| 33 | * |
||
| 34 | * @return string|null |
||
| 35 | */ |
||
| 36 | public function getName() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Add a single Event to the stack |
||
| 43 | * |
||
| 44 | * @param Event $event |
||
| 45 | * @return $this |
||
| 46 | */ |
||
| 47 | 2 | public function add(Event $event) |
|
| 53 | |||
| 54 | /** |
||
| 55 | * Creates a new Event, adds it to the schedule stack and returns you the instance so you can configure it |
||
| 56 | * |
||
| 57 | * @param callable|string $event |
||
| 58 | * @return Event |
||
| 59 | */ |
||
| 60 | 2 | public function run($event) |
|
| 71 | |||
| 72 | /** |
||
| 73 | * @return Event[] |
||
| 74 | */ |
||
| 75 | public function allEvents() |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Get all of the events on the schedule that are due. |
||
| 82 | * |
||
| 83 | * @return Event[] |
||
| 84 | */ |
||
| 85 | public function dueEvents() |
||
| 91 | } |
||
| 92 |