1 | <?php |
||
5 | trait AttachmentHelpers |
||
6 | { |
||
7 | /** |
||
8 | * Set an Image/more than one Image only for iOS. |
||
9 | * |
||
10 | * @param string|array $imageUrl |
||
11 | * |
||
12 | * @return $this |
||
13 | */ |
||
14 | 1 | public function setIosAttachment($imageUrl) |
|
19 | |||
20 | /** |
||
21 | * Set the Big Picture Image only for Android. |
||
22 | * |
||
23 | * @param string $imageUrl |
||
24 | * |
||
25 | * @return $this |
||
26 | */ |
||
27 | 1 | public function setAndroidBigPicture(string $imageUrl) |
|
31 | |||
32 | /** |
||
33 | * Set the Big Picture Image only for FireOS (Amazon). |
||
34 | * |
||
35 | * @param string $imageUrl |
||
36 | * |
||
37 | * @return $this |
||
38 | */ |
||
39 | 1 | public function setAmazonBigPicture(string $imageUrl) |
|
43 | |||
44 | /** |
||
45 | * Set the Big Picture Image only for Chrome. |
||
46 | * |
||
47 | * @param string $imageUrl |
||
48 | * |
||
49 | * @return $this |
||
50 | */ |
||
51 | 1 | public function setChromeBigPicture(string $imageUrl) |
|
55 | |||
56 | /** |
||
57 | * Set the additional URL for all Platforms. |
||
58 | * |
||
59 | * @param string $url |
||
60 | * |
||
61 | * @return $this |
||
62 | */ |
||
63 | 6 | public function setUrl(string $url) |
|
67 | |||
68 | /** |
||
69 | * Set an image to all possible attachment variables. |
||
70 | * |
||
71 | * @param string $imageUrl |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | 1 | public function setImageAttachments(string $imageUrl) |
|
82 | } |
||
83 |
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.