data['options'][] = array( 'value' => $value, 'text' => isset($text) ? $text : $value, 'more' => $more ); return $this; } public function options(array $options) : Select{ foreach($options as $option){ if(is_string($option)){ $this->option($option); continue; } $this->data['options'][] = $option; //TODO convert to $this->option } return $this; } public function valid(mixed $data)/*: bool|string*/{ $parent = parent::valid($data); if($parent !== true || !isset($data)) return $parent; foreach($this->data['options'] as $option){ if($option['value'] == $data) return $parent; } return 'incorrect'; } public function html(string $more = '') : string{ $html = ''; } }