/** * 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; }
/** * 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; }