/** * 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; }
/** * 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; }
/** * 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); }
public function testGetHttpClientReturnsDefault() { $gcm = new Client(); $this->assertEquals('Zend\\Http\\Client', get_class($gcm->getHttpClient())); $this->assertTrue($gcm->getHttpClient() instanceof HttpClient); }