Пример #1
0
 /**
  * Get opened client.
  *
  * @return \ZendService\Google\Gcm\Client
  */
 public function getOpenedClient()
 {
     if (!isset($this->openedClient)) {
         $this->openedClient = new ServiceClient();
         $this->openedClient->setApiKey($this->getParameter('apiKey'));
         $newClient = new \Zend\Http\Client(null, array('adapter' => 'Zend\\Http\\Client\\Adapter\\Socket', 'sslverifypeer' => false));
         $this->openedClient->setHttpClient($newClient);
     }
     return $this->openedClient;
 }
Пример #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;
 }