1 | <?php |
||
5 | trait AppearanceHelpers |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * Set the iOS badge increment count. |
||
10 | * |
||
11 | * @param int $count |
||
12 | * |
||
13 | * @return $this |
||
14 | */ |
||
15 | 1 | public function incrementIosBadgeCount(int $count = 1) |
|
16 | { |
||
17 | 1 | return $this->setParameter('ios_badgeType', 'Increase') |
|
|
|||
18 | 1 | ->setParameter('ios_badgeCount', $count); |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * Set the iOS badge decrement count. |
||
23 | * |
||
24 | * @param int $count |
||
25 | * |
||
26 | * @return $this |
||
27 | */ |
||
28 | 1 | public function decrementIosBadgeCount(int $count = 1) |
|
29 | { |
||
30 | 1 | return $this->setParameter('ios_badgeType', 'Increase') |
|
31 | 1 | ->setParameter('ios_badgeCount', -1 * $count); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Set the iOS badge count. |
||
36 | * |
||
37 | * @param int $count |
||
38 | * |
||
39 | * @return $this |
||
40 | */ |
||
41 | 1 | public function setIosBadgeCount(int $count) |
|
42 | { |
||
43 | 1 | return $this->setParameter('ios_badgeType', 'SetTo') |
|
44 | 1 | ->setParameter('ios_badgeCount', $count); |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * Set the iOS Sound. |
||
49 | * |
||
50 | * @param string $soundUrl |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function setIosSound(string $soundUrl) |
||
55 | { |
||
56 | return $this->setParameter('ios_sound', $soundUrl); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Set the Android Sound. |
||
61 | * |
||
62 | * @param string $soundUrl |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function setAndroidSound(string $soundUrl) |
||
67 | { |
||
68 | return $this->setParameter('android_sound', $soundUrl); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Set the Windows Sound. |
||
73 | * |
||
74 | * @param string $soundUrl |
||
75 | * |
||
76 | * @return $this |
||
77 | */ |
||
78 | public function setWindowsSound(string $soundUrl) |
||
79 | { |
||
80 | return $this->setParameter('wp_sound', $soundUrl) |
||
81 | ->setParameter('wp_wns_sound', $soundUrl); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Set the Sound for all Systems. |
||
86 | * |
||
87 | * @param string $soundUrl |
||
88 | * |
||
89 | * @return $this |
||
90 | */ |
||
91 | public function setSound(string $soundUrl) |
||
97 | |||
98 | /** |
||
99 | * Set the message icon. |
||
100 | * |
||
101 | * @param string $iconPath |
||
102 | * |
||
103 | * @deprecated use setIcon instead |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | 5 | public function icon(string $iconPath) |
|
111 | |||
112 | /** |
||
113 | * Set the message icon. |
||
114 | * |
||
115 | * @param string $iconPath |
||
116 | * |
||
117 | * @return $this |
||
118 | */ |
||
119 | 6 | public function setIcon(string $iconPath) |
|
126 | } |
||
127 |
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.