value = $value; $this->docs = $docs; $this->for = $for; $this->as = $as; } public function __invoke(): void { $attributes = [ 'class' => 'block text-sm font-medium leading-6 text-gray-900', ]; if ($this->as === 'label') { $attributes['for'] = esc_attr($this->for); } echo sprintf( '<%1$s %2$s>%3$s%4$s', $this->as, Str::htmlAttributes($attributes), esc_html($this->value), $this->docs ? $this->renderDocsLink() : '' ); } protected function renderDocsLink(): string { return sprintf( ' (docs)', esc_url($this->docs) ); } }