choice( PublicKeyCredentialType::ALL, 'type "%s" is not an element of the valid values: %s' ); Assert::that( Algorithms::getHashAlgorithmFor( $alg ) )->notEmpty( 'alg "%s" is not a valid algorithm.' ); $this->type = $type; $this->alg = $alg; } public static function hydrate( array $data ): self { Assert::that( $data, 'PublicKeyCredentialParameters hydration does not contain "%s".' ) ->keyExists( 'type' ) ->keyExists( 'alg' ); return new self( $data['type'], $data['alg'] ); } public function get_type(): string { return $this->type; } public function get_alg(): int { return $this->alg; } public function jsonSerialize(): array { return get_object_vars( $this ); } }