title = $title; $this->readOnlyHint = $readOnlyHint; $this->destructiveHint = $destructiveHint; $this->idempotentHint = $idempotentHint; $this->openWorldHint = $openWorldHint; } /** * Creates an instance from an array. * * @param array{ * title?: string|null, * readOnlyHint?: bool|null, * destructiveHint?: bool|null, * idempotentHint?: bool|null, * openWorldHint?: bool|null * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { return new self( self::asStringOrNull($data['title'] ?? null), self::asBoolOrNull($data['readOnlyHint'] ?? null), self::asBoolOrNull($data['destructiveHint'] ?? null), self::asBoolOrNull($data['idempotentHint'] ?? null), self::asBoolOrNull($data['openWorldHint'] ?? null) ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = []; if ($this->title !== null) { $result['title'] = $this->title; } if ($this->readOnlyHint !== null) { $result['readOnlyHint'] = $this->readOnlyHint; } if ($this->destructiveHint !== null) { $result['destructiveHint'] = $this->destructiveHint; } if ($this->idempotentHint !== null) { $result['idempotentHint'] = $this->idempotentHint; } if ($this->openWorldHint !== null) { $result['openWorldHint'] = $this->openWorldHint; } return $result; } /** * @return string|null */ public function getTitle(): ?string { return $this->title; } /** * @return bool|null */ public function getReadOnlyHint(): ?bool { return $this->readOnlyHint; } /** * @return bool|null */ public function getDestructiveHint(): ?bool { return $this->destructiveHint; } /** * @return bool|null */ public function getIdempotentHint(): ?bool { return $this->idempotentHint; } /** * @return bool|null */ public function getOpenWorldHint(): ?bool { return $this->openWorldHint; } }