/** * Get opened client. * * @param \ZendService\Apple\Apns\Client\AbstractClient $client * @param string $certificate * @param string $passPhrase * @param bool $sandbox * * @throws \Jgut\Tify\Exception\AdapterException * * @return \ZendService\Apple\Apns\Client\AbstractClient * * @codeCoverageIgnore */ protected function buildClient(AbstractClient $client, $certificate, $passPhrase = '', $sandbox = false) { try { $client->open((bool) $sandbox ? AbstractClient::SANDBOX_URI : AbstractClient::PRODUCTION_URI, $certificate, $passPhrase); } catch (\Exception $exception) { throw new AdapterException($exception->getMessage(), $exception->getCode(), $exception); } return $client; }
/** * Open zend client. * * @param ZendAbstractClient $client * @return ZendAbstractClient */ protected function openZendClient(ZendAbstractClient $client) { try { $client->open($this->getOption('prod') ? ZendAbstractClient::PRODUCTION_URI : ZendAbstractClient::SANDBOX_URI, $this->getOption('cert'), $this->getOption('pass')); } catch (\Exception $e) { throw new AdapterException($e->getMessage()); } return $client; }
/** * Get opened client. * * @param \ZendService\Apple\Apns\Client\AbstractClient $client Client * * @return \ZendService\Apple\Apns\Client\AbstractClient */ public function getOpenedClient(ServiceAbstractClient $client) { $client->open($this->isProductionEnvironment() ? ServiceClient::PRODUCTION_URI : ServiceClient::SANDBOX_URI, $this->getParameter('certificate'), $this->getParameter('passPhrase')); return $client; }