Пример #1
0
 /**
  * Get opened client.
  *
  * @param \ZendService\Google\Gcm\Client $client Client
  *
  * @return \ZendService\Google\Gcm\Client
  */
 public function getOpenedClient(ServiceClient $client)
 {
     $client->setApiKey($this->getParameter('apiKey'));
     $newClient = new \Zend\Http\Client(null, array('adapter' => 'Zend\\Http\\Client\\Adapter\\Socket', 'sslverifypeer' => false));
     $client->setHttpClient($newClient);
     return $client;
 }
Пример #2
0
 /**
  * Get opened push service client.
  *
  * @param string $apiKey
  *
  * @return \ZendService\Google\Gcm\Client
  */
 public function buildPushClient($apiKey)
 {
     $client = new Client();
     $client->setApiKey($apiKey);
     $httpClient = new HttpClient(null, ['service' => Socket::class, 'strictredirects' => true, 'sslverifypeer' => false]);
     $client->setHttpClient($httpClient);
     return $client;
 }
Пример #3
0
 /**
  * Send the \ZendService\Google\Gcm\Message
  *
  * @param $serviceMessage
  *
  * @return \ZendService\Google\Gcm\Response
  */
 protected function send($serviceMessage)
 {
     $client = new Client();
     $client->setApiKey(array_get($this->config, 'key'));
     return $client->send($serviceMessage);
 }
Пример #4
0
 public function testGetHttpClientReturnsDefault()
 {
     $gcm = new Client();
     $this->assertEquals('Zend\\Http\\Client', get_class($gcm->getHttpClient()));
     $this->assertTrue($gcm->getHttpClient() instanceof HttpClient);
 }