name = $name; $this->options = $options; $this->value = $value; $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); $label = ""; $select = ""; $this->createLabel(); $this->html = str_replace('{input}', $select, $this->inputTemplate->getInputTemplate()); $this->html = str_replace('{label}', $this->labelString, $this->html); return $this; } /** * @param string $name * @param array $options * @param $value * @param array $paramsArray * @return void */ public static function build(string $name, array $options = [], $value = null, array $paramsArray = []): void { $select = new self($name, $options, $value, $paramsArray); $select->create()->render(); } /** * @param $options * @return $this */ public function setOptions($options) { $this->options = array_merge($options, $this->options); return $this; } }