1 | <?php |
||
5 | abstract class AbstractRegistration implements RegistrationInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var \DomDocument |
||
9 | */ |
||
10 | protected $dom; |
||
11 | |||
12 | /** |
||
13 | * @var \DOMNode |
||
14 | */ |
||
15 | protected $content; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $token; |
||
21 | |||
22 | /** |
||
23 | * @var string|string[] |
||
24 | */ |
||
25 | protected $tags; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $template; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $registrationId; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $eTag; |
||
41 | |||
42 | /** |
||
43 | * Initializes a new Registration. |
||
44 | */ |
||
45 | public function __construct() |
||
60 | |||
61 | /** |
||
62 | * Sets Gcm Registration ID or APNs Device token. |
||
63 | * |
||
64 | * @param string $token |
||
65 | * |
||
66 | * @return RegistrationInterface this object |
||
67 | */ |
||
68 | public function setToken($token) |
||
74 | |||
75 | /** |
||
76 | * Sets the tags. |
||
77 | * |
||
78 | * @param mixed $tags |
||
79 | * |
||
80 | * @return RegistrationInterface this object |
||
81 | */ |
||
82 | public function setTags($tags) |
||
88 | |||
89 | /** |
||
90 | * Sets the template for the body. |
||
91 | * |
||
92 | * @param string $template |
||
93 | * |
||
94 | * @return RegistrationInterface this object |
||
95 | */ |
||
96 | public function setTemplate($template) |
||
102 | |||
103 | /** |
||
104 | * Sets the registration ID for update or delete registration API. |
||
105 | * |
||
106 | * @param string $registrationId |
||
107 | * |
||
108 | * @return RegistrationInterface this object |
||
109 | */ |
||
110 | public function setRegistrationId($registrationId) |
||
116 | |||
117 | /** |
||
118 | * Returns the token. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getToken() |
||
123 | { |
||
124 | return $this->token; |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * Returns the registration ID. |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getRegistrationId() |
||
136 | |||
137 | /** |
||
138 | * Sets the ETag for update or delete registration API. |
||
139 | * |
||
140 | * @param string $eTag |
||
141 | * |
||
142 | * @return RegistrationInterface this object |
||
143 | */ |
||
144 | public function setETag($eTag) |
||
150 | |||
151 | /** |
||
152 | * Returns the ETag. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getETag() |
||
160 | |||
161 | /** |
||
162 | * {@inheritdoc} |
||
163 | */ |
||
164 | public function buildUri($endpoint, $hubPath) |
||
174 | |||
175 | /** |
||
176 | * {@inheritdoc} |
||
177 | */ |
||
178 | public function getContentType() |
||
182 | |||
183 | /** |
||
184 | * {@inheritdoc} |
||
185 | */ |
||
186 | public function getHeaders() |
||
199 | |||
200 | /** |
||
201 | * Returns the atom payload for the registration request. |
||
202 | * |
||
203 | * @throws \RuntimeException |
||
204 | * |
||
205 | * @return string |
||
206 | */ |
||
207 | public function getPayload() |
||
223 | |||
224 | /** |
||
225 | * {@inheritdoc} |
||
226 | */ |
||
227 | public function scrapeResponse($response) |
||
252 | |||
253 | /** |
||
254 | * Appends the registration description DOMNode. |
||
255 | * |
||
256 | * @return \DOMNode |
||
257 | */ |
||
258 | protected function appendDescriptionNode() |
||
272 | |||
273 | /** |
||
274 | * Appends the 'Tags' DOMNode. |
||
275 | * |
||
276 | * @param \DOMNode $descriptionNode |
||
277 | */ |
||
278 | protected function appendTagNode($descriptionNode) |
||
286 | |||
287 | /** |
||
288 | * Appends the token DOMNode. |
||
289 | * |
||
290 | * @param \DOMNode $descriptionNode |
||
291 | */ |
||
292 | protected function appendTokenNode($descriptionNode) |
||
296 | |||
297 | /** |
||
298 | * Appends the 'BodyTemplate' DOMNode. |
||
299 | * |
||
300 | * @param \DOMNode $descriptionNode |
||
301 | */ |
||
302 | protected function appendTemplateNode($descriptionNode) |
||
311 | |||
312 | /** |
||
313 | * Appends the additional DOMNode. |
||
314 | * |
||
315 | * @param \DOMNode $descriptionNode |
||
316 | */ |
||
317 | protected function appendAdditionalNode($descriptionNode) |
||
320 | |||
321 | /** |
||
322 | * Returns the tags. |
||
323 | * |
||
324 | * @return string |
||
325 | */ |
||
326 | private function getTags() |
||
334 | } |
||
335 |