Wrep\Notificato\Apns\Certificate::getEndpoint PHP Method

getEndpoint() public method

Get the endpoint this certificate is valid for
public getEndpoint ( $endpointType ) : string
return string
    public function getEndpoint($endpointType)
    {
        // Check if the endpoint type is valid
        if (self::ENDPOINT_TYPE_GATEWAY !== $endpointType && self::ENDPOINT_TYPE_FEEDBACK !== $endpointType) {
            throw new \InvalidArgumentException($endpointType . ' is not a valid endpoint type.');
        }
        return self::$endpoints[$this->endpointEnv][$endpointType];
    }

Usage Example

 public function testInvalidGetEndpointSandbox()
 {
     $certificate = new Certificate(__DIR__ . '/.././resources/../resources/certificate_corrupt.pem', null, false, Certificate::ENDPOINT_ENV_SANDBOX);
     $this->setExpectedException('InvalidArgumentException', 'is not a valid endpoint type.');
     $certificate->getEndpoint('invalid');
 }