caption = $caption; } protected function makeLegend(): string { return $this->caption !== null ? (new CTag('legend', true, new CSpan($this->caption)))->toString() : ''; } protected function bodyToString(): string { return $this->makeLegend().parent::bodyToString(); } }