@param string|null $text
@param string|null $value
@param bool $selected

@return \Spatie\Html\Elements\Option
778582
public function option($text = null, $value = null, $selected = false)
    {
        return Option::create()
            ->text($text)
            ->value($value)
            ->selectedIf($selected);
    }
673164
public function addOption(string $content, string $value) : Option
    {
        $option = new Option($content, $value);
        $this->elements[] = $option;

        return $option;
    }
1151319
public function setText($text = null)
    {
        $text = trim($text);
        $this->text = 0 < strlen($text) ? $text : null;

        return $this;
    }
1040490
@Override
	public final void select(final String optionText) {
		if(optionText.contains("submit::")){
			String value = optionText.split("::")[1];
			select(Type.VALUE, value);
		}else {
			select(Type.TEXT, optionText);
		}
	}
208596
public function iFillTheUiSelectWithAndSelectElement($id, $text, $item)
    {
        $items = explode("-", $item);
        if(count($items) > 1){
            $item = $items[0].'-'.((int)$items[1] - 1);
        }else {
            $item = "0-".((int)$item - 1);
        }
        
        $this->iClickTheElement(sprintf("#%s > div.ui-select-match.ng-scope > span",$id));
        $idText = sprintf("#%s > input.ui-select-search",$id);
//        var_dump($idText);
        $this->spin(function($context) use ($idText){
            $element = $context->findElement($idText);
            return $element != null;
        },20);
        
        $this->getSession()->getDriver()->executeScript(
            sprintf('$("%s").val("%s");',$idText,$text)
        );
        $this->getSession()->getDriver()->executeScript(
            sprintf('$("%s").change();',$idText)
        );
//        $selectInput = $this->findElement($idText);     
//        $selectInput->setValue($text);
                
        $idItem = sprintf("#ui-select-choices-row-%s",$item);
        $this->spin(function($context) use ($idItem){
            $element = $context->findElement($idItem);
            return $element != null;
        },20);
        $element = $this->findElement($idItem);
        $element->click();
    }
1143246
def select_option(selectName, text)	
				Selenium::WebDriver::Support::Select.new(find_element(:name, selectName)).select_by(:text, text)
      end
380551
private function createOptionNode($value, $text)
    {
        $option = new NodeElement();
        $option->openTag('option')
               ->addAttribute('value', $value);

        // Mark as selected on demand
        if ($this->isActiveNode($value)) {
            $option->addProperty('selected');
        }

        // If callback is provided, then use it to build attributes
        if ($this->optionVisitor instanceof Closure) {
            $result = call_user_func($this->optionVisitor, $value, $text);

            // Visitor must return an array containing these keys
            if (is_array($result)) {
                $option->addAttributes($result);
            } else {
                // Incorrect returned value
                throw new UnexpectedValueException(
                    sprintf('The visitor must return associative array with attribute names and their corresponding values. Received - "%s"', gettype($result))
                );
            }
        }

        $option->finalize()
               ->setText($text)
               ->closeTag();

        return $option;
    }
958807
public function createOption($label, $value = null, $selected = false)
    {
        $option = new Option();
        $option->textContent->push($label);

        if (isset($value)) {
            $option->attributes->addAttribute('value', $value);
        }

        if ($selected) {
            $option->selected();
        }

        $this->childNodes->push($option);

        return $this->childNodes->last();
    }
485375
public static function text($name, $value = '', array $htmlOptions = [])
    {
    	return self::input('text', $name, $value) . self::htmlOptions($htmlOptions) .'>';
    }
72793
public function select_text() {
        // NodeElement.keyPress simply doesn't work.
        if (!$this->running_javascript()) {
            throw new coding_exception('Selecting text requires javascript.');
        }

        $editorid = $this->field->getAttribute('id');
        $js = ' (function() {
    var e = document.getElementById("'.$editorid.'editable"),
        r = rangy.createRange(),
        s = rangy.getSelection();

    while ((e.firstChild !== null) && (e.firstChild.nodeType != document.TEXT_NODE)) {
        e = e.firstChild;
    }
    e.focus();
    r.selectNodeContents(e);
    s.setSingleRange(r);
}()); ';
        $this->session->executeScript($js);
    }
1315017
public function addOption($value, $text)
	{
		if (!is_scalar($value)) {
			throw new DataGridColumnStatusException('Option value has to be scalar');
		}

		$option = new Option($this, $value, $text);

		$this->options[] = $option;

		return $option;
	}
1354837
public function checkSelectedValue($value)
  {
    if (is_null($this->selected)) {
      return false;
    }

    if (is_array($this->selected)) {
      return in_array($value, $this->selected);
    }

    return $this->selected == $value;
  }
22265
public function createOptions(array $options, $selected = null)
    {
        foreach ($options as $label => $value) {
            $option = $this->createOption($label, $value);

            if (is_array($selected) && in_array($value, $selected)) {
                $option->selected();
            } elseif ($selected === $value) {
                $option->selected();
            }
        }

        return $this;
    }
1135678
public static function toSelect($selectedValue = null, array $options = null)
    {
        $selectOptions = array();
        $selectOptions['class'] = $options['class'] ?? "";
        $selectOptions['id'] = $options['id'] ?? "";
        $selectOptions['name'] = $options['name'] ?? "";

        $reflection = new \ReflectionClass(static::class);

        $html = "<select class='".$selectOptions['class']."' name='".$selectOptions['name']."'>";
        foreach($reflection->getConstants() as $constant => $value)
        {
            $html .= "<option value='{$value}' ".static::isSelectedHTML($selectedValue, $value).">".
                self::WordifyConst($constant)."</option>";
        }
        $html .= "</select>";
        return $html;
    }
613493
protected function buildSelectOptions($options, $selectedValues = array())
    {
        $str = '';
        $inOptgroup = false;
        foreach ($options as $opt) {
            // $str = '';
            if (isset($opt['optgroup'])) {
                if ($inOptgroup) {
                    $str .= '</optgroup>'."\n";
                    $inOptgroup = false;
                }
                if ($opt['optgroup']) {
                    // open an optgroup
                    $attribs = $opt['attribs'];
                    $attribs['label'] = $opt['label'];
                    $str .= '<optgroup'.Html::buildAttribString($attribs).'>'."\n";
                    $inOptgroup = true;
                }
            } else {
                $optAttribs = \array_merge(array(
                    // 'cname' => 'option',
                    // 'innerhtml' => \htmlspecialchars($opt['label']),
                    'selected' => \in_array($opt['attribs']['value'], $selectedValues),
                ), $opt['attribs']);
                // unset($optAttribs['label']);
                $str .= Html::buildTag('option', $optAttribs, \htmlspecialchars($opt['label']))."\n";
            }
            // $this->props['attribs']['innerhtml'] .= $str;
        }
        if ($inOptgroup) {
            // $this->props['attribs']['innerhtml'] .= '</optgroup>';
            $str .= '</optgroup>'."\n";
        }
        return $str;
    }
138029
public function setSelected(bool $selected) : Option
    {
        if ($selected) {
            $this->tag->setAttribute('selected', 'selected');
        } else {
            $this->tag->removeAttribute('selected');
        }

        return $this;
    }
1018983
public function setValue($value = null)
    {

		if(isset($value)) {

			//ENT_QUOTES not set

			$this->value = array_map('htmlspecialchars', (array) $value);
		}

		foreach($this->options as $o) {

			$v = $this->getValue();

			if(is_array($v) && in_array($o->getValue(), $v)) {
				$o->select();
			}
			else {
				$o->unselect();
			}
		}
		
		return $this;

	}