original_string: public function setValue($value)
  	{
  		// set default
  		if( $value === "" )
  		{
  			$value = $this->value;
  		}
  
  		if( $this->type === "boolean" )
  		{
  			$value = is_bool($value) ? $value : in_array($value, ['y', 'yes', 'on', '1']);
  		}
  		else if( $this->type === "number" )
  		{
  			if( ! is_numeric($value) )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " must be a number");
  			}
  			$value = (float) $value;
  			if( $this->required && $value === 0 )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " is required");
  			}
  		}
  		else if( $this->type === "enum" )
  		{
  			if( ! in_array($value, $this->enum, true) )
  			{
  				$variant = "'" . implode("' or '", $this->enum) . "'";
  				throw new \InvalidArgumentException($this->getTheTitle() . " must be equal " . $variant);
  			}
  		}
  		else
  		{
  			$value = trim($value);
  			if( $this->required && ! strlen($value) )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " is required");
  			}
  		}
  
  		if( $this->type_of )
  		{
  			$value = call_user_func($this->type_of, $value);
  			if( $value === false && $this->type !== "boolean" )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " value is invalid");
  			}
  		}
  
  		$this->value = $value;
  		return $this;
  	}
code: public function setValue($value)
  	{
  		// set default
  		if( $value === "" )
  		{
  			$value = $this->value;
  		}
  
  		if( $this->type === "boolean" )
  		{
  			$value = is_bool($value) ? $value : in_array($value, ['y', 'yes', 'on', '1']);
  		}
  		else if( $this->type === "number" )
  		{
  			if( ! is_numeric($value) )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " must be a number");
  			}
  			$value = (float) $value;
  			if( $this->required && $value === 0 )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " is required");
  			}
  		}
  		else if( $this->type === "enum" )
  		{
  			if( ! in_array($value, $this->enum, true) )
  			{
  				$variant = "'" . implode("' or '", $this->enum) . "'";
  				throw new \InvalidArgumentException($this->getTheTitle() . " must be equal " . $variant);
  			}
  		}
  		else
  		{
  			$value = trim($value);
  			if( $this->required && ! strlen($value) )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " is required");
  			}
  		}
  
  		if( $this->type_of )
  		{
  			$value = call_user_func($this->type_of, $value);
  			if( $value === false && $this->type !== "boolean" )
  			{
  				throw new \InvalidArgumentException($this->getTheTitle() . " value is invalid");
  			}
  		}
  
  		$this->value = $value;
  		return $this;
  	}
code_tokens: public function setValue ( $ value ) { // set default if ( $ value === "" ) { $ value = $ this -> value ; } if ( $ this -> type === "boolean" ) { $ value = is_bool ( $ value ) ? $ value : in_array ( $ value , [ 'y' , 'yes' , 'on' , '1' ] ) ; } else if ( $ this -> type === "number" ) { if ( ! is_numeric ( $ value ) ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " must be a number" ) ; } $ value = ( float ) $ value ; if ( $ this -> required && $ value === 0 ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " is required" ) ; } } else if ( $ this -> type === "enum" ) { if ( ! in_array ( $ value , $ this -> enum , true ) ) { $ variant = "'" . implode ( "' or '" , $ this -> enum ) . "'" ; throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " must be equal " . $ variant ) ; } } else { $ value = trim ( $ value ) ; if ( $ this -> required && ! strlen ( $ value ) ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " is required" ) ; } } if ( $ this -> type_of ) { $ value = call_user_func ( $ this -> type_of , $ value ) ; if ( $ value === false && $ this -> type !== "boolean" ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " value is invalid" ) ; } } $ this -> value = $ value ; return $ this ; }
docstring: Set new value
  
  @param $value
  @return $this
docstring_tokens: Set new value