Set var value.

@param $varname
@param $value
@param bool $required
@return bool
328810
public function setvarval($varname, $value, $required = false) {
		if (!isset($this->fields[$varname])) {
			return false;
		}
		$type = $this->fields[$varname]->type;

		switch ($type) {
			case 'int':
			case 'integer':
				if ((empty($value)) && ($required)) {
					return false;
				}
				$this->{$varname} = (int)$value;
				return true;
			case 'float':
				if ((empty($value)) && ($required)) {
					return false;
				}
				$this->{$varname} = (float)$value;
				return true;
			case 'itm':
			case 'item':
				if ((empty($value)) && ($required)) {
					return false;
				}
				$this->{$varname} = (int)$value;
				return true;
			case 'bool':
			case 'boolean':
				$this->{$varname} = (bool)$value;
				return true;
			case 'str':
			case 'string':
				$value2 = $value;
				//If the fiels is alias, that
				if ((empty($value2)) && (!empty($this->fields[$varname]->alias))) {
					$str = '';
					foreach ($this->fields[$varname]->alias as $aliasfld) {
						$str .= (empty($str) ? '' : '-') . $this->{$aliasfld};
					}
					$value2 = \Brilliant\CMS\BLang::generatealias($str);
				}
				if ((empty($value2)) && ($required)) {
					return false;
				}
				$this->{$varname} = $value2;
				return true;
			case 'binary':
				$this->{$varname} = $value;
				return true;
			case 'enum':
				//Check enum
				$this->{$varname} = $value;
				return true;
			case 'dt':
				$obj = NULL;
				if ((empty($value)) && ($required)) {
					return false;
				}
				if (!empty($value)) {
					$obj = new \Brilliant\BDateTime($value);
				}
				$this->{$varname} = $obj;
				return true;
			case 'image':
				bimport('images.single');
				if ((empty($value)) && ($required)) {
					return false;
				}
				$img = new BImage();
				$img->url = $value;
				$this->{$varname} = $img;
				return true;
			case 'json':
				if ((empty($value)) && ($required)) {
					return false;
				}
				$this->{$varname} = $value;
				return true;
		}
		return false;
	}
904529
public function requireWith($value) {
        $this->check_role = 'require';
        $result = true;
        if ($value) {
            $result = !empty($this->value) || '0' == $this->value;
        }
        $this->checkResult($result);
    }
159562
public function setRequired($required) {
		if(!empty($required))
			$this->validation[] = new Validation\Required;
		$this->_attributes["required"] = "";	
	}
351637
public static function setVar($name,$value){
		self::init();
		self::$variables[$name]=$value;
		return true;
		}
820216
public function setVariable($name, $value)
    {
        if (is_null($value)) {
            unset($this->variables[$name]);
        }
        else {
            $this->variables[$name] = $value;
        }
        return $this;
    }
249378
public function setVal($name, $value = null)
    {
        $type = gettype($name);
        if('string' === $type)
        {
            $name = explode('.', $name);
        }
        else if('array' !== $type)
        {
            return false;
        }
        $last = array_pop($name);
        $data = &$this->data;
        foreach ($name as $val)
        {
            if (! isset($data[$val]))
            {
                $data[$val] = array ();
            }
            $data = &$data[$val];
        }
        $data[$last] = $value;
        return true;
    }
1251074
function setVariable( $blockName, $variableName, $variableValue )
    {
        if ( !$this->isSettingReadOnly( $this->filename(), $blockName, $variableName ) )
            return false;

        $this->BlockValues[$blockName][$variableName] = $variableValue;
        $this->ModifiedBlockValues[$blockName][$variableName] = true;
    }
976275
public function setVar($name, $value)
	{
		$this->vars[$name] = $value;

		$this->query = null;

		return $this;
	}
653940
public function setVariable($key, $value)
    {
        $key = (string) $key;
        $this->currentRequest->variables->$key = $value;
        return true;
    }
914007
function assign($name,$value=null){
        if(is_array($name)){
            foreach($name as $vk => $v){
                $this->vars[$vk] = $v;
            }
        }else{
            $this->vars[$name] = $value;
        }   
    }
552238
public function set($name, $value) {
		$this->vars[$name] = is_object($value) ? (method_exists($value, 'fetch') ? $value->fetch() : $value) : $value;
	}
1194316
public static function setToken(string $variableName = '_MF_SESSION_INTEGRITY_TOKEN_'): bool
    {
        static::init();
        $variableName = (string)$variableName;
        $vHandler = Variables::getInstance();
        $vHandler->session->set($variableName, static::buildToken());
        return true;
    }
1344385
protected function set($key, $value, bool $variadic = false): bool
    {
        if (null === $key) {
            $this->_values[] = $value;
        } elseif ($variadic) {
            $this->_values[$key] = \array_merge($this->_values[$key], (array) $value);
        } else {
            $this->_values[$key] = $value;
        }

        return !\in_array($value, [true, false, null], true);
    }
736289
public function set_var( $key, $value ) {
		if ( null === $this->wp_query->get( $key, null ) ) {
			$this->vars[ $key ] = $value;
			$this->wp_query->set( $key, $value );
		}
	}
1181726
public function required($required = true, $required_value = true)
    {
        if ($required == $required_value) {
            $this->addClass('required');
            $this->aria('required', 'true');

            return parent::attr('required', 'required');
        }

        return $this;
    }
1032832
public function set($key, $value) {
        header('' . $key . ': ' . $value . '', true);
        $this->vars[$key] = $value;
    }
577479
public function setOption($varname, $varvalue=null)
        {
            $keys = array_keys($this->_options);
            if(gettype($varname) === 'array')
            {
                foreach($varname as $name=>$value)
                {
                    $this->setOption($name, $value);
                }
            }
            else
            {
                if(in_array($varname, $keys) === true)
                {
                    $this->_options[$varname] = $varvalue;
                }
                switch($varname)
                {
                    case 'template_directory' :
                        self::$template_directory_base = $varvalue;
                        break;
                    case 'tag_directory' :
                        self::$tag_directory_base = $varvalue;
                        break;
                    case 'missing_tags_error_mode' :
                        self::$error_mode = $varvalue;
                        break;
                    case 'custom_cache_tag_class' :
                        if(class_exists($varvalue) === false)
                        {
                            $this->_options['cache_tags'] = false;
                        }
                        break;
                    case 'cache_directory' :
                        if(is_dir($varvalue) === false || is_writable($varvalue) === false)
                        {
                            $this->_options['cache_tags'] = false;
                        }
                        break;
                }
            }
        }