1 | <?php |
||
22 | class GcmService extends AbstractService implements SendInterface |
||
23 | { |
||
24 | /** |
||
25 | * Status codes mapping. |
||
26 | * |
||
27 | * @see https://developers.google.com/cloud-messaging/http-server-ref |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $statusCodes = [ |
||
32 | 'MissingRegistration' => 'Missing Registration Token', |
||
33 | 'InvalidRegistration' => 'Invalid Registration Token', |
||
34 | 'NotRegistered' => 'Unregistered Recipient', |
||
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 | 'RecipientMessageRateExceeded' => 'Recipient Message Rate Exceeded', |
||
43 | 'TopicsMessageRateExceeded' => 'Topics Message Rate Exceeded', |
||
44 | 'UnknownError' => 'Unknown Error', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * @var \ZendService\Google\Gcm\Client |
||
49 | */ |
||
50 | protected $pushClient; |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | * |
||
55 | * @throws \InvalidArgumentException |
||
56 | */ |
||
57 | public function send(AbstractNotification $notification) |
||
100 | |||
101 | /** |
||
102 | * Get opened client. |
||
103 | * |
||
104 | * @return \ZendService\Google\Gcm\Client |
||
105 | */ |
||
106 | protected function getPushService() |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | protected function getDefinedParameters() |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | protected function getRequiredParameters() |
||
130 | } |
||
131 |