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

doRequestChallenges() private méthode

Requests challenges for a given DNS name.
private doRequestChallenges ( string $dns ) : Generator
$dns string DNS name to request challenge for
Résultat Generator coroutine resolved by Amp returning an array of challenges
    private function doRequestChallenges($dns)
    {
        if (!is_string($dns)) {
            throw new InvalidArgumentException(sprintf("\$dns must be of type string, %s given.", gettype($dns)));
        }
        /** @var Response $response */
        $response = (yield $this->acmeClient->post(AcmeResource::NEW_AUTHORIZATION, ["identifier" => ["type" => "dns", "value" => $dns]]));
        if ($response->getStatus() === 201) {
            if (!$response->hasHeader("location")) {
                throw new AcmeException("Protocol violation: Response didn't carry any location header.");
            }
            (yield new CoroutineResult([current($response->getHeader("location")), json_decode($response->getBody())]));
            return;
        }
        throw $this->generateException($response);
    }