1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NotificationChannels\OneSignal\Traits; |
4
|
|
|
|
5
|
|
|
use NotificationChannels\OneSignal\OneSignalButton; |
6
|
|
|
use NotificationChannels\OneSignal\OneSignalWebButton; |
7
|
|
|
|
8
|
|
|
trait Deprecated |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Set the message body. |
12
|
|
|
* |
13
|
|
|
* @param mixed $value |
14
|
|
|
* |
15
|
|
|
* @deprecated use setBody instead |
16
|
|
|
* |
17
|
|
|
* @return $this |
18
|
|
|
*/ |
19
|
|
|
public function body($value) |
20
|
|
|
{ |
21
|
|
|
return $this->setBody($value); |
|
|
|
|
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Set the message subject. |
26
|
|
|
* |
27
|
|
|
* @param mixed $value |
28
|
|
|
* |
29
|
|
|
* @deprecated Use setSubject instead |
30
|
|
|
* |
31
|
|
|
* @return $this |
32
|
|
|
*/ |
33
|
9 |
|
public function subject($value) |
34
|
|
|
{ |
35
|
9 |
|
return $this->setParameter('headings', $this->parseValueToArray($value)); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Set the message url. |
40
|
|
|
* |
41
|
|
|
* @param string $value |
42
|
|
|
* |
43
|
|
|
* @deprecated use setUrl Instead |
44
|
|
|
* |
45
|
|
|
* @return $this |
46
|
|
|
*/ |
47
|
9 |
|
public function url($value) |
48
|
|
|
{ |
49
|
9 |
|
return $this->setUrl($value); |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Add a web button to the message. |
54
|
|
|
* |
55
|
|
|
* @param OneSignalWebButton $button |
56
|
|
|
* |
57
|
|
|
* @deprecated use setWebButton instead |
58
|
|
|
* |
59
|
|
|
* @return $this |
60
|
|
|
*/ |
61
|
1 |
|
public function webButton(OneSignalWebButton $button) |
62
|
|
|
{ |
63
|
1 |
|
return $this->setWebButton($button); |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Adds more than one web button to the message. |
68
|
|
|
* |
69
|
|
|
* @param array[OnSignalWebButton] $buttons |
|
|
|
|
70
|
|
|
* |
71
|
|
|
* @deprecated use setWebButtons instead |
72
|
|
|
* |
73
|
|
|
* @return $this |
74
|
|
|
*/ |
75
|
|
|
public function webButtons(array $buttons) |
76
|
|
|
{ |
77
|
|
|
return $this->setWebButtons($buttons); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Add a native button to the message. |
82
|
|
|
* |
83
|
|
|
* @param OneSignalButton $button |
84
|
|
|
* |
85
|
|
|
* @deprecated use setButton instead |
86
|
|
|
* @return $this |
87
|
|
|
*/ |
88
|
|
|
public function button(OneSignalButton $button) |
89
|
|
|
{ |
90
|
|
|
return $this->setButton($button); |
|
|
|
|
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Adds more than one native button to the message. |
95
|
|
|
* |
96
|
|
|
* @param array $buttons |
97
|
|
|
* |
98
|
|
|
* @deprecated use setButtons instead |
99
|
|
|
* |
100
|
|
|
* @return $this |
101
|
|
|
*/ |
102
|
|
|
public function buttons(array $buttons) |
103
|
|
|
{ |
104
|
|
|
return $this->setButtons($buttons); |
|
|
|
|
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
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.