File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,25 @@ class Sender implements LoggerAwareInterface
2121 private $ logger ;
2222 /** @var HttpClient */
2323 private $ httpClient ;
24+ /** @var string */
25+ private $ GCMSendEndpoint ;
2426
2527 public function __construct ($ key )
2628 {
2729 if (!$ key ) {
2830 throw new \InvalidArgumentException ();
2931 }
3032 $ this ->key = $ key ;
33+
34+ $ this ->GCMSendEndpoint = Constants::GCM_SEND_ENDPOINT ;
35+ }
36+
37+ /**
38+ * @param string $url
39+ */
40+ public function setEndPointUrl ($ url )
41+ {
42+ $ this ->GCMSendEndpoint = $ url ;
3143 }
3244
3345 /**
@@ -177,7 +189,7 @@ public function sendNoRetry(Message $message, array $registrationIds)
177189 }
178190
179191 $ conn = $ this ->post (
180- Constants:: GCM_SEND_ENDPOINT ,
192+ $ this -> GCMSendEndpoint ,
181193 "application/json " ,
182194 $ requestBody
183195 );
@@ -302,7 +314,7 @@ public function singleSendNoRetry(Message $message, $registrationId)
302314 if ($ this ->logger ) {
303315 $ this ->logger ->debug ('Request body: ' . $ requestBody );
304316 }
305- $ conn = $ this ->post (Constants:: GCM_SEND_ENDPOINT , "text/plain " , $ requestBody );
317+ $ conn = $ this ->post ($ this -> GCMSendEndpoint , "text/plain " , $ requestBody );
306318 $ status = $ conn ->getResponseCode ();
307319 if ($ status == 503 ) {
308320 if ($ this ->logger ) {
You can’t perform that action at this time.
0 commit comments