original_string: public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0)
  	{
  		// Ensure hash and type are uppercase
  		$hash = strtoupper($hash);
  
  		if ($hash === 'METHOD')
  		{
  			$hash = strtoupper($_SERVER['REQUEST_METHOD']);
  		}
  
  		$type = strtoupper($type);
  		$sig = $hash . $type . $mask;
  
  		// Get the input hash
  		switch ($hash)
  		{
  			case 'GET':
  				$input = &$_GET;
  				break;
  			case 'POST':
  				$input = &$_POST;
  				break;
  			case 'FILES':
  				$input = &$_FILES;
  				break;
  			case 'COOKIE':
  				$input = &$_COOKIE;
  				break;
  			case 'ENV':
  				$input = &$_ENV;
  				break;
  			case 'SERVER':
  				$input = &$_SERVER;
  				break;
  			default:
  				$input = &$_REQUEST;
  				$hash = 'REQUEST';
  				break;
  		}
  
  		if (isset($GLOBALS['_JREQUEST'][$name]['SET.' . $hash]) && ($GLOBALS['_JREQUEST'][$name]['SET.' . $hash] === true))
  		{
  			// Get the variable from the input hash
  			$var = (isset($input[$name]) && $input[$name] !== null) ? $input[$name] : $default;
  			$var = self::_cleanVar($var, $mask, $type);
  		}
  		elseif (!isset($GLOBALS['_JREQUEST'][$name][$sig]))
  		{
  			if (isset($input[$name]) && $input[$name] !== null)
  			{
  				// Get the variable from the input hash and clean it
  				$var = self::_cleanVar($input[$name], $mask, $type);
  
  				$GLOBALS['_JREQUEST'][$name][$sig] = $var;
  			}
  			elseif ($default !== null)
  			{
  				// Clean the default value
  				$var = self::_cleanVar($default, $mask, $type);
  			}
  			else
  			{
  				$var = $default;
  			}
  		}
  		else
  		{
  			$var = $GLOBALS['_JREQUEST'][$name][$sig];
  		}
  
  		return $var;
  	}
code: public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0)
  	{
  		// Ensure hash and type are uppercase
  		$hash = strtoupper($hash);
  
  		if ($hash === 'METHOD')
  		{
  			$hash = strtoupper($_SERVER['REQUEST_METHOD']);
  		}
  
  		$type = strtoupper($type);
  		$sig = $hash . $type . $mask;
  
  		// Get the input hash
  		switch ($hash)
  		{
  			case 'GET':
  				$input = &$_GET;
  				break;
  			case 'POST':
  				$input = &$_POST;
  				break;
  			case 'FILES':
  				$input = &$_FILES;
  				break;
  			case 'COOKIE':
  				$input = &$_COOKIE;
  				break;
  			case 'ENV':
  				$input = &$_ENV;
  				break;
  			case 'SERVER':
  				$input = &$_SERVER;
  				break;
  			default:
  				$input = &$_REQUEST;
  				$hash = 'REQUEST';
  				break;
  		}
  
  		if (isset($GLOBALS['_JREQUEST'][$name]['SET.' . $hash]) && ($GLOBALS['_JREQUEST'][$name]['SET.' . $hash] === true))
  		{
  			// Get the variable from the input hash
  			$var = (isset($input[$name]) && $input[$name] !== null) ? $input[$name] : $default;
  			$var = self::_cleanVar($var, $mask, $type);
  		}
  		elseif (!isset($GLOBALS['_JREQUEST'][$name][$sig]))
  		{
  			if (isset($input[$name]) && $input[$name] !== null)
  			{
  				// Get the variable from the input hash and clean it
  				$var = self::_cleanVar($input[$name], $mask, $type);
  
  				$GLOBALS['_JREQUEST'][$name][$sig] = $var;
  			}
  			elseif ($default !== null)
  			{
  				// Clean the default value
  				$var = self::_cleanVar($default, $mask, $type);
  			}
  			else
  			{
  				$var = $default;
  			}
  		}
  		else
  		{
  			$var = $GLOBALS['_JREQUEST'][$name][$sig];
  		}
  
  		return $var;
  	}
code_tokens: public static function getVar ( $ name , $ default = null , $ hash = 'default' , $ type = 'none' , $ mask = 0 ) { // Ensure hash and type are uppercase $ hash = strtoupper ( $ hash ) ; if ( $ hash === 'METHOD' ) { $ hash = strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) ; } $ type = strtoupper ( $ type ) ; $ sig = $ hash . $ type . $ mask ; // Get the input hash switch ( $ hash ) { case 'GET' : $ input = & $ _GET ; break ; case 'POST' : $ input = & $ _POST ; break ; case 'FILES' : $ input = & $ _FILES ; break ; case 'COOKIE' : $ input = & $ _COOKIE ; break ; case 'ENV' : $ input = & $ _ENV ; break ; case 'SERVER' : $ input = & $ _SERVER ; break ; default : $ input = & $ _REQUEST ; $ hash = 'REQUEST' ; break ; } if ( isset ( $ GLOBALS [ '_JREQUEST' ] [ $ name ] [ 'SET.' . $ hash ] ) && ( $ GLOBALS [ '_JREQUEST' ] [ $ name ] [ 'SET.' . $ hash ] === true ) ) { // Get the variable from the input hash $ var = ( isset ( $ input [ $ name ] ) && $ input [ $ name ] !== null ) ? $ input [ $ name ] : $ default ; $ var = self :: _cleanVar ( $ var , $ mask , $ type ) ; } elseif ( ! isset ( $ GLOBALS [ '_JREQUEST' ] [ $ name ] [ $ sig ] ) ) { if ( isset ( $ input [ $ name ] ) && $ input [ $ name ] !== null ) { // Get the variable from the input hash and clean it $ var = self :: _cleanVar ( $ input [ $ name ] , $ mask , $ type ) ; $ GLOBALS [ '_JREQUEST' ] [ $ name ] [ $ sig ] = $ var ; } elseif ( $ default !== null ) { // Clean the default value $ var = self :: _cleanVar ( $ default , $ mask , $ type ) ; } else { $ var = $ default ; } } else { $ var = $ GLOBALS [ '_JREQUEST' ] [ $ name ] [ $ sig ] ; } return $ var ; }
docstring: Fetches and returns a given variable.
  
  The default behaviour is fetching variables depending on the
  current request method: GET and HEAD will result in returning
  an entry from $_GET, POST and PUT will result in returning an
  entry from $_POST.
  
  You can force the source by setting the $hash parameter:
  
  post    $_POST
  get     $_GET
  files   $_FILES
  cookie  $_COOKIE
  env     $_ENV
  server  $_SERVER
  method  via current $_SERVER['REQUEST_METHOD']
  default $_REQUEST
  
  @param   string   $name     Variable name.
  @param   string   $default  Default value if the variable does not exist.
  @param   string   $hash     Where the var should come from (POST, GET, FILES, COOKIE, METHOD).
  @param   string   $type     Return type for the variable, for valid values see {@link JFilterInput::clean()}.
  @param   integer  $mask     Filter mask for the variable.
  
  @return  mixed  Requested variable.
  
  @since   11.1
  
  @deprecated   12.1  Use JInput::Get
docstring_tokens: Fetches and returns a given variable .