*/ private array $blocks = []; public function h1(string $text): self { $this->blocks[] = ['type' => 'h1', 'text' => $text]; return $this; } public function h2(string $text): self { $this->blocks[] = ['type' => 'h2', 'text' => $text]; return $this; } public function h3(string $text): self { $this->blocks[] = ['type' => 'h3', 'text' => $text]; return $this; } public function paragraph(string $text): self { $text = trim($text); if ($text === '') { return $this; } $this->blocks[] = ['type' => 'p', 'text' => $text]; return $this; } public function bullet(string $text): self { $this->blocks[] = ['type' => 'bullet', 'text' => $text]; return $this; } public function link(string $label, string $url): self { $this->blocks[] = ['type' => 'link', 'text' => $label, 'url' => $url]; return $this; } public function spacer(): self { $this->blocks[] = ['type' => 'spacer']; return $this; } /** * @return list */ public function blocks(): array { return $this->blocks; } }