| 1 | <?php |
||
| 12 | trait TicketSelector |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Use to select a quantity from the first ticket for the given event (so this can be used on a event archive page). |
||
| 17 | * @param int|string $event_id |
||
| 18 | * @param int|string $quantity |
||
| 19 | */ |
||
| 20 | public function selectQuantityOfFirstTicketForEventId($event_id, $quantity = 1) |
||
| 24 | |||
| 25 | |||
| 26 | /** |
||
| 27 | * Used to submit the ticket selection for the given event id (so this can be used on an event archive page). |
||
| 28 | * @param int|string $event_id |
||
| 29 | */ |
||
| 30 | public function submitTicketSelectionsForEventId($event_id) |
||
| 34 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.