| 1 | <?php |
||
| 5 | trait GroupingHelpers |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Set the Android Grouping Parameters. |
||
| 9 | * |
||
| 10 | * @param string $group |
||
| 11 | * @param array $groupMessage |
||
| 12 | * |
||
| 13 | * @return $this |
||
| 14 | */ |
||
| 15 | public function setAndroidGroup(string $group, array $groupMessage) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Set the Amazon (FireOS) Grouping Parameters. |
||
| 23 | * |
||
| 24 | * @param string $group |
||
| 25 | * @param array $groupMessage |
||
| 26 | * |
||
| 27 | * @return $this |
||
| 28 | */ |
||
| 29 | public function setAmazonGroup(string $group, array $groupMessage) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Set the Grouping Parameters for all available Systems (currently Android and Amazon (FireOs)). |
||
| 37 | * |
||
| 38 | * @param string $group |
||
| 39 | * @param array $groupMessage |
||
| 40 | * |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | public function setGroup(string $group, array $groupMessage) |
||
| 48 | } |
||
| 49 |
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.