1 | <?php |
||
19 | class Gcm extends AbstractService implements SendInterface |
||
20 | { |
||
21 | /** |
||
22 | * Status codes translation. |
||
23 | * |
||
24 | * @see https://developers.google.com/cloud-messaging/http-server-ref |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | private static $statusCodes = [ |
||
29 | 'MissingRegistration' => 'Missing Registration Token', |
||
30 | 'InvalidRegistration' => 'Invalid Registration Token', |
||
31 | 'NotRegistered' => 'Unregistered Recipient', |
||
32 | 'InvalidPackageName' => 'Invalid Package Name', |
||
33 | 'MismatchSenderId' => 'Mismatched Sender', |
||
34 | 'MessageTooBig' => 'Message Too Big', |
||
35 | 'InvalidDataKey' => 'Invalid Data Key', |
||
36 | 'InvalidTtl' => 'Invalid Time to Live', |
||
37 | 'Unavailable' => 'Timeout', |
||
38 | 'InternalServerError' => 'Internal Server Error', |
||
39 | 'RecipientMessageRateExceeded' => 'Recipient Message Rate Exceeded', |
||
40 | 'TopicsMessageRateExceeded' => 'Topics Message Rate Exceeded', |
||
41 | 'UnknownError' => 'Unknown Error', |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * @var \ZendService\Google\Gcm\Client |
||
46 | */ |
||
47 | protected $pushClient; |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | * |
||
52 | * @throws \InvalidArgumentException |
||
53 | */ |
||
54 | public function send(AbstractNotification $notification) |
||
102 | |||
103 | /** |
||
104 | * Get opened client. |
||
105 | * |
||
106 | * @param string $apiKey |
||
107 | * |
||
108 | * @return \ZendService\Google\Gcm\Client |
||
109 | */ |
||
110 | protected function getPushService($apiKey) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | protected function getDefinedParameters() |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | protected function getDefaultParameters() |
||
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | */ |
||
138 | protected function getRequiredParameters() |
||
142 | } |
||
143 |