1 | <?php |
||
22 | class GcmAdapter extends AbstractAdapter implements SendAdapter |
||
23 | { |
||
24 | /** |
||
25 | * Status codes mapping. |
||
26 | * |
||
27 | * @see https://developers.google.com/cloud-messaging/http-server-ref |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected static $statusCodes = [ |
||
32 | 'MissingRegistration' => 'Missing Registration Token', |
||
33 | 'InvalidRegistration' => 'Invalid Registration Token', |
||
34 | 'NotRegistered' => 'Unregistered Device', |
||
35 | 'InvalidPackageName' => 'Invalid Package Name', |
||
36 | 'MismatchSenderId' => 'Mismatched Sender', |
||
37 | 'MessageTooBig' => 'Message Too Big', |
||
38 | 'InvalidDataKey' => 'Invalid Data Key', |
||
39 | 'InvalidTtl' => 'Invalid Time to Live', |
||
40 | 'Unavailable' => 'Timeout', |
||
41 | 'InternalServerError' => 'Internal Server Error', |
||
42 | 'DeviceMessageRateExceeded' => 'Device Message Rate Exceeded', |
||
43 | 'TopicsMessageRateExceeded' => 'Topics Message Rate Exceeded', |
||
44 | 'UnknownError' => 'Unknown Error', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * GCM service builder. |
||
49 | * |
||
50 | * @var \Jgut\Tify\Adapter\Gcm\GcmBuilder |
||
51 | */ |
||
52 | protected $builder; |
||
53 | |||
54 | /** |
||
55 | * @var \ZendService\Google\Gcm\Client |
||
56 | */ |
||
57 | protected $pushClient; |
||
58 | |||
59 | /** |
||
60 | * @param array $parameters |
||
61 | * @param \Jgut\Tify\Adapter\Gcm\GcmBuilder $builder |
||
|
|||
62 | * |
||
63 | * @throws \Jgut\Tify\Exception\AdapterException |
||
64 | */ |
||
65 | public function __construct(array $parameters = [], GcmBuilder $builder = null) |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | * |
||
80 | * @throws \InvalidArgumentException |
||
81 | * @throws \RuntimeException |
||
82 | */ |
||
83 | public function send(Notification $notification) |
||
119 | |||
120 | /** |
||
121 | * Get opened client. |
||
122 | * |
||
123 | * @return \ZendService\Google\Gcm\Client |
||
124 | */ |
||
125 | protected function getPushClient() |
||
133 | |||
134 | /** |
||
135 | * Get push service formatted messages. |
||
136 | * |
||
137 | * @param \Jgut\Tify\Notification $notification |
||
138 | * |
||
139 | * @throws \InvalidArgumentException |
||
140 | * @throws \RuntimeException |
||
141 | * |
||
142 | * @return \ZendService\Google\Gcm\Message |
||
143 | */ |
||
144 | protected function getPushMessages(Notification $notification) |
||
166 | |||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | */ |
||
170 | protected function getDefinedParameters() |
||
174 | |||
175 | /** |
||
176 | * {@inheritdoc} |
||
177 | */ |
||
178 | protected function getRequiredParameters() |
||
182 | } |
||
183 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.