1 | <?php |
||
9 | class Schedule |
||
10 | { |
||
11 | /** |
||
12 | * Stack of events |
||
13 | * @var Event[] |
||
14 | */ |
||
15 | protected $events = []; |
||
16 | |||
17 | /** |
||
18 | * @var string|null |
||
19 | */ |
||
20 | protected $name; |
||
21 | |||
22 | 2 | public function __construct(/* string */ $name = null) |
|
28 | |||
29 | /** |
||
30 | * Get the name of this schedule |
||
31 | * |
||
32 | * @return string|null |
||
33 | */ |
||
34 | public function getName() |
||
38 | |||
39 | /** |
||
40 | * Add a single Event to the stack |
||
41 | * |
||
42 | * @param Event $event |
||
43 | * @return $this |
||
44 | */ |
||
45 | 2 | public function add(Event $event) |
|
51 | |||
52 | /** |
||
53 | * Creates a new Event, adds it to the schedule stack and returns you the instance so you can configure it |
||
54 | * |
||
55 | * @param string $command |
||
56 | * @return Event |
||
57 | */ |
||
58 | 2 | public function run(/* string */ $command) |
|
67 | |||
68 | /** |
||
69 | * @return Event[] |
||
70 | */ |
||
71 | public function allEvents() |
||
75 | |||
76 | /** |
||
77 | * Get all of the events on the schedule that are due. |
||
78 | * |
||
79 | * @return Event[] |
||
80 | */ |
||
81 | public function dueEvents() |
||
87 | } |
||
88 |