75, 'text' => 75, 'value' => 75, 'url' => 3000, ]; public function __construct(Text $text,string $value) { parent::__construct(); if (strlen($text->text) > self::LIMITS['text']) throw new Exception(sprintf('Text must be %d chars or less',self::LIMITS['text'])); $this->text = $text; $this->value = $this->validate('value',$value); } public static function item(Text $text,string $value): self { return new self($text,$value); } /* OPTIONAL ITEMS */ public function description(Text $text): self { if ($text->type != 'plain_text') throw new Exception(sprintf('Text must be plain_text not %s',$text->type)); if (strlen($text->text) > self::LIMITS['description']) throw new Exception(sprintf('Text must be %d chars or less',self::LIMITS['description'])); $this->description = $text; return $this; } public function url(string $string): self { $this->url = $this->validate('url',$string); return $this; } }