| 1 | <?php |
||
| 6 | trait DeliveryHelpers |
||
| 7 | { |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Set the send after |
||
| 11 | * |
||
| 12 | * @param string $date |
||
| 13 | * |
||
| 14 | * @return $this |
||
| 15 | */ |
||
| 16 | public function setSendAfter(string $date) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Set the deplayed option |
||
| 23 | * |
||
| 24 | * @param string $delayedOption |
||
| 25 | * |
||
| 26 | * @return $this |
||
| 27 | */ |
||
| 28 | public function setDelayedOption(string $delayedOption) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Set the delivery at time of the day. Use with delayed option = timezone |
||
| 35 | * |
||
| 36 | * @param string $timeOfDay |
||
| 37 | * |
||
| 38 | * @return $this |
||
| 39 | */ |
||
| 40 | public function setDeliveryTimeOfDay(string $timeOfDay) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Set the Time to Live in Seconds |
||
| 47 | * |
||
| 48 | * @param int $ttl |
||
| 49 | * |
||
| 50 | * @return $this |
||
| 51 | */ |
||
| 52 | public function setTTL(int $ttl) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Set the Priority |
||
| 59 | * |
||
| 60 | * @param int $priority |
||
| 61 | * |
||
| 62 | * @return $this |
||
| 63 | */ |
||
| 64 | public function setPriority(string $priority) |
||
| 68 | |||
| 69 | } |
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.