public function __construct($directoryUri, KeyPair $keyPair, HttpClient $http = null) { if (!is_string($directoryUri)) { throw new InvalidArgumentException(sprintf("\$directoryUri must be of type string, %s given.", gettype($directoryUri))); } $this->directoryUri = $directoryUri; $this->keyPair = $keyPair; $this->http = $http ?: $this->buildClient(); $this->nonces = []; }