Select all options that have a value matching the argument.

@param mixed $value The value to match against.

@return self
@throws SelectException When option with given value can't be found.
776248
public function selectByValue($value)
	{
		$options = $this->getOptionsByValue($value);

		if ( !$options ) {
			throw new SelectException('Cannot locate option with value: ' . $value, SelectException::TYPE_NOT_FOUND);
		}

		return $this->selectOptions($options, !$this->isMultiple());
	}
1300087
public function validate($value)
        {
            if (!in_array(gettype($value), $this->types)) {
                throw new Exception('Type of value "'.gettype($value)."' is not compatible with ".get_class($this));
            }
        }
1283129
public static function get($value): self
    {
        $class = get_called_class();

        if ($value instanceof self) {
            $value = $value->value();
        }

        if (!static::has($value)) {
            throw EnumException::invalidEnumValue($class, $value);
        }

        return static::all()[$value];
    }
254690
public function setOption($option, $value)
    {
        $option                 = strtolower($option);
        $this->options[$option] = $value;
        return $this;
    }
344427
public function setValue( $value ) {
		$this->value = $this->cleanUpValue( $value );
		// Deselect all options
		foreach ( $this->fields as $field ) {
			$field->getField()->setSelected( false );
		}
		// Select the requested ones
		foreach ( $this->value as $key ) {
			$this->fields[ $key ]->getField()->setSelected( true );
		}
		return $this;
	}
683399
public function exor($value){
        if($this->value !== null){
            return $this->markErrorIf($value !== null);
        }
        if($value !== null){
            return $this->markErrorIf($this->value !== null);
        }
        return $this;
    }
230481
public function setOption($option, $value)
    {
        switch ($option) {
            case FTPClient::TIMEOUT_SEC:
                if ($value <= 0) {
                    throw new Exception('Timeout value must be greater than zero');
                }
                break;

            case FTPClient::AUTOSEEK:
                if (!is_bool($value)) {
                    throw new Exception('Autoseek value must be boolean');
                }
                break;
            
            default:
                throw new Exception('Unsupported option');
                break;
        }

        return @ftp_set_option($this->connection, $option, $value);
    }
1106241
public function setValue($value) : self
    {
        if (is_bool($value)) {
            $value = ($value == true) ? '1' : '0';
        }

        $this->field->addAttribute('value', !is_null($value) ? (string) $value : '');

        return $this;
    }
1227629
public function setSelectedOption( $value ) {
        foreach( $this->children as $option ) {
            if( $option->getAttribute( 'value' ) == $value ) {
                $option->setAttribute( 'selected', true );
            }
        }
    }
678479
public function filter($value, $options = [])
    {
        if ($this->getPattern() == null) {
            $ex = new \Exception(get_class($this) . ' does not have a valid MatchPattern set.');
            throw $ex;
        }

        return preg_replace($this->getPattern(), $this->getReplacement(), $value);
    }
855097
public function setOption($option, $value) {
        //Silence it because errors handled differently
        $res = @curl_setopt($this->handler, $option, $value);

        if($res === TRUE) {
            return $this;
        }

        throw new RuntimeException('Failed to set the following option: ' . $option);
    }
1074978
public function setOption($option, $value)
    {
        if (! (@ldap_set_option($this->connection, $option, $value))) {
            $code = @ldap_errno($this->connection);
            throw new OptionException(
                sprintf(
                    'Could not change option %s value: Ldap Error Code=%s - %s',
                    $code,
                    ldap_err2str($code)
                )
            );
        }
    }
730237
public function getOptionsByValue($value)
    {
        $options = array();

        foreach ($this->options as $option) {
            if ($option->value === $value) {
                $options[] = $option;
            }
        }

        return $options;
    }
159515
public function setMatch($value)
    {
        switch (gettype($value)) {
            case 'array':
                $this->match = $value;
                break;
            case 'string':
                $this->match = [$value];
                break;
            case 'boolean':
                if ($value === false) {
                    $this->match = false;
                    break;
                }
                // Match could not be true.
            default:
                throw new InvalidConfigException("Invalid configuration. Wrong march type '{$value}'.");
        }
    }
28841
public function setValue(string $value) : void
    {
        $this->value = $value;
        foreach ((array)$this as $option) {
            if ($option->getValue() == $value) {
                $option->selected();
            } else {
                $option->unselected();
            }
        }
    }
328699
public function getFirstSelectedOption()
	{
		foreach ( $this->getOptions() as $option ) {
			if ( $option->isSelected() ) {
				return $option;
			}
		}

		throw new SelectException('No options are selected', SelectException::TYPE_NOT_SELECTED);
	}
37636
public function setValue($value) {
		if (is_array($value)) {
		    foreach ($value as $singleValue) {
		        if (!$this->isValueValid($singleValue)) {
		            throw new \Exception('Unexpected value type');
		        }
		    }
		} elseif (!$this->isValueValid($value)) {
		    throw new \Exception('Unexpected value type');
		}
		$this->value = $value;

		return $this;
	}