1 | <?php |
||
5 | trait DeliveryHelpers |
||
6 | { |
||
7 | /** |
||
8 | * Set the send after. |
||
9 | * |
||
10 | * @param string $date |
||
11 | * |
||
12 | * @return $this |
||
13 | */ |
||
14 | public function setSendAfter(string $date) |
||
18 | |||
19 | /** |
||
20 | * Set the deplayed option. |
||
21 | * |
||
22 | * @param string $delayedOption |
||
23 | * |
||
24 | * @return $this |
||
25 | */ |
||
26 | public function setDelayedOption(string $delayedOption) |
||
30 | |||
31 | /** |
||
32 | * Set the delivery at time of the day. Use with delayed option = timezone. |
||
33 | * |
||
34 | * @param string $timeOfDay |
||
35 | * |
||
36 | * @return $this |
||
37 | */ |
||
38 | public function setDeliveryTimeOfDay(string $timeOfDay) |
||
42 | |||
43 | /** |
||
44 | * Set the Time to Live in Seconds. |
||
45 | * |
||
46 | * @param int $ttl |
||
47 | * |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function setTtl(int $ttl) |
||
54 | |||
55 | /** |
||
56 | * Set the Priority. |
||
57 | * |
||
58 | * @param int $priority |
||
59 | * |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function setPriority(int $priority) |
||
66 | } |
||
67 |
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
Idable
provides a methodequalsId
that 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.