1 | <?php |
||
5 | class IonicPushMessage |
||
6 | { |
||
7 | /** @var string */ |
||
8 | public $sendTo = 'tokens'; |
||
9 | |||
10 | /** @var string */ |
||
11 | public $profile; |
||
12 | |||
13 | /** @var string */ |
||
14 | public $title = ''; |
||
15 | |||
16 | /** @var string */ |
||
17 | public $message = ''; |
||
18 | |||
19 | /** @var string */ |
||
20 | public $sound = ''; |
||
21 | |||
22 | /** @var array */ |
||
23 | public $payload = []; |
||
24 | |||
25 | /** @var array */ |
||
26 | public $iosData = []; |
||
27 | |||
28 | /** @var array */ |
||
29 | public $androidData = []; |
||
30 | |||
31 | /** |
||
32 | * @param array $data |
||
|
|||
33 | * |
||
34 | * @return static |
||
35 | */ |
||
36 | 3 | public static function create($profile) |
|
40 | |||
41 | /** |
||
42 | * @param string $profile |
||
43 | */ |
||
44 | 11 | public function __construct($profile) |
|
48 | |||
49 | /** |
||
50 | * Set the method of targeting users - tokens (default), user_ids, or emails. |
||
51 | * |
||
52 | * @param string $profile |
||
53 | * |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function sendTo($sendTo) |
||
62 | |||
63 | /** |
||
64 | * Set the title. |
||
65 | * |
||
66 | * @param string $title |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | 1 | public function title($title) |
|
71 | { |
||
72 | 1 | $this->title = $title; |
|
73 | |||
74 | 1 | return $this; |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * Set the message. |
||
79 | * |
||
80 | * @param string $message |
||
81 | * |
||
82 | * @return $this |
||
83 | */ |
||
84 | 3 | public function message($message) |
|
90 | |||
91 | /** |
||
92 | * Set the security sound to use. |
||
93 | * |
||
94 | * @param string $sound |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function sound($sound) |
||
104 | |||
105 | /** |
||
106 | * Send custom key/value data with your notifications. |
||
107 | * |
||
108 | * @param array $payload |
||
109 | * |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function payload($payload) |
||
118 | |||
119 | /** |
||
120 | * Dynamically add device specific data. |
||
121 | * |
||
122 | * @param string $method |
||
123 | * @param array $args |
||
124 | * |
||
125 | * @return object |
||
126 | */ |
||
127 | 6 | public function __call($method, $args) |
|
128 | { |
||
129 | 6 | if (substr($method, 0, 3) == 'ios') { |
|
130 | 5 | $key = snake_case(substr($method, 3)); |
|
131 | |||
132 | 5 | if (in_array($key, $this->allowediOSOptions())) { |
|
133 | 5 | $this->iosData[$key] = $args[0]; |
|
134 | } |
||
135 | 3 | } elseif (substr($method, 0, 7) == 'android') { |
|
136 | 1 | $key = snake_case(substr($method, 7)); |
|
137 | |||
138 | 1 | if (in_array($key, $this->allowedAndroidOptions())) { |
|
139 | 1 | $this->androidData[$key] = $args[0]; |
|
140 | } |
||
141 | } |
||
142 | |||
143 | 6 | return $this; |
|
144 | } |
||
145 | |||
146 | /** |
||
147 | * Get the method we want to use to send messages. |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | 3 | public function getSendToType() |
|
155 | |||
156 | /** |
||
157 | * List of allowed Android options. |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | 1 | public function allowedAndroidOptions() |
|
178 | |||
179 | /** |
||
180 | * List of allowed iOS options. |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | 5 | public function allowediOSOptions() |
|
197 | |||
198 | /** |
||
199 | * @return array |
||
200 | */ |
||
201 | 10 | public function toArray() |
|
232 | } |
||
233 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.