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