*/ private const KNOWN_KEYS = ['progressToken']; /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. * * @var string|number|null */ protected $progressToken; /** * Keys carried on the wire that this type does not model. Preserved verbatim so unrecognized fields survive a round trip. * * @var array|null */ protected ?array $additionalProperties; /** * @param string|number|null $progressToken * @param array|null $additionalProperties */ public function __construct( $progressToken = null, ?array $additionalProperties = null ) { $this->progressToken = $progressToken; $this->additionalProperties = $additionalProperties; } /** * Creates an instance from an array. * * @param array{ * progressToken?: string|number|null * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { /** @var string|number|null $progressToken */ $progressToken = isset($data['progressToken']) ? self::asStringOrNumberOrNull($data['progressToken']) : null; return new self( $progressToken, self::additionalFields($data, self::KNOWN_KEYS) ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = []; if ($this->progressToken !== null) { $result['progressToken'] = $this->progressToken; } return $result + ($this->additionalProperties ?? []); } /** * @return string|number|null */ public function getProgressToken() { return $this->progressToken; } /** * @return array|null */ public function getAdditionalProperties(): ?array { return $this->additionalProperties; } }