name = $name; $this->paramsArray = $paramsArray; $this->inputTemplate = new SimpleTemplate(); } /** * @return $this */ public function create(): self { $paramsString = $this->createParams($this->paramsArray); $optionsString = $this->createOption($this->options, $this->value); $radioButton = "$optionsString"; $label = ""; $this->createLabel(); $this->html = str_replace('{input}', $radioButton, $this->inputTemplate->getInputTemplate()); $this->html = str_replace('{label}', $this->labelString, $this->html); return $this; } /** * @param string $name * @param array $paramsArray * @return void */ public static function build(string $name, array $paramsArray = []): void { $radioButton = new self($name, $paramsArray); $radioButton->create()->render(); } /** * @param $options * @return $this */ public function setOptions($options) { $this->options = array_merge($options, $this->options); return $this; } }