choice( [ self::TYPE_CREATE, self::TYPE_GET ], 'type "%s" is not an element of the valid values: %s' ); Assert::that( $origin ) ->notBlank( 'origin "%s" is blank, but was expected to contain a value.' ); $this->type = $type; $this->challenge = $challenge; $this->origin = $origin; $this->crossOrigin = $crossOrigin; } public static function hydrate( array $data ): self { Assert::that( $data, 'CollectedClientData hydration does not contain "%s".' ) ->keyExists( 'type' ) ->keyExists( 'challenge' ) ->keyExists( 'origin' ); return new self( $data['type'], BinaryString::from_ascii( $data['challenge'] ), $data['origin'], $data['crossOrigin'] ?? null ); } public function get_type(): string { return $this->type; } public function get_challenge(): BinaryString { return $this->challenge; } public function get_origin(): string { return $this->origin; } public function is_cross_origin(): ?bool { return $this->crossOrigin; } }