Kelunik\Acme\AcmeService::doRevokeCertificate PHP Méthode

doRevokeCertificate() private méthode

Revokes a certificate.
private doRevokeCertificate ( string $pem ) : Generator
$pem string PEM encoded certificate
Résultat Generator coroutine resolved by Amp returning true
    private function doRevokeCertificate($pem)
    {
        if (!is_string($pem)) {
            throw new InvalidArgumentException(sprintf("\$pem must be of type string, %s given.", gettype($pem)));
        }
        $begin = "CERTIFICATE-----";
        $end = "----END";
        $pem = substr($pem, strpos($pem, $begin) + strlen($begin));
        $pem = substr($pem, 0, strpos($pem, $end));
        $enc = new Base64UrlSafeEncoder();
        /** @var Response $response */
        $response = (yield $this->acmeClient->post(AcmeResource::REVOKE_CERTIFICATE, ["certificate" => $enc->encode(base64_decode($pem))]));
        if ($response->getStatus() === 200) {
            (yield new CoroutineResult(true));
            return;
        }
        throw $this->generateException($response);
    }