$maxLength){ throw new \InvalidArgumentException(sprintf("$name must be at most %d bytes, but have %d bytes", $maxLength, strlen($string))); } } public function __construct(string $text, string $photoName = ""){ self::checkLength($text, "Text", self::PAGE_LENGTH_HARD_LIMIT_BYTES); self::checkLength($photoName, "Photo name", self::PHOTO_NAME_LENGTH_HARD_LIMIT_BYTES); Utils::checkUTF8($text); $this->text = $text; $this->photoName = $photoName; } public function getText() : string{ return $this->text; } public function getPhotoName() : string{ return $this->photoName; } }