action = $action; $this->method = $method; } public function addField(HtmlElement $el){ $this->elements[] = $el; } public function render(): string { $content = implode(PHP_EOL, array_map(fn($el) => $el->render(), $this->elements)); return sprintf('
%s
', $this->action, $this->method, $content); } }