Skip to content

Commit

Permalink
Merge branch 'feature/improvements' of https://github.com/mambax7/xmf
Browse files Browse the repository at this point in the history
…into feature/improvements

# Conflicts:
#	src/Request.php
  • Loading branch information
mambax7 committed Oct 31, 2023
2 parents 2d57b8c + b38cbf8 commit b46b280
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
8 changes: 3 additions & 5 deletions src/ProxyCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,12 @@ protected function getProxyEnvConfig()
*/
protected function getProxyHeader()
{
if (($this->proxyHeaderName === false) || (!isset($_SERVER[$this->proxyHeaderName])) || (empty($_SERVER[$this->proxyHeaderName]))) {
if (false === $this->proxyHeaderName || empty($_SERVER[$this->proxyHeaderName])) {
return false;
}
}

// Use PHP 5.3 compatible type casting
$proxyHeader = (string)$_SERVER[$this->proxyHeaderName];

return $proxyHeader;
return (string)$_SERVER[$this->proxyHeaderName];
}

/**
Expand Down
20 changes: 10 additions & 10 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function getVar($name, $default = null, $hash = 'default', $type =
{
// Ensure hash and type are uppercase
$hash = strtoupper($hash);
if ($hash === 'METHOD') {
if ('METHOD' === $hash) {
$hash = static::getMethod();
}
$type = strtoupper($type);
Expand Down Expand Up @@ -123,10 +123,10 @@ public static function getVar($name, $default = null, $hash = 'default', $type =
$var = static::stripSlashesRecursive($var);
}
} elseif (null !== $default) {
// Clean the default value
$var = static::cleanVar($default, $mask, $type);
} else {
$var = $default;
// Clean the default value
$var = static::cleanVar($default, $mask, $type);
} else {
$var = $default;

}

Expand Down Expand Up @@ -392,9 +392,9 @@ public static function hasVar($name, $hash = 'default')
/**
* Set a variable in one of the request variables
*
* @param string $name Name
* @param string $value Value
* @param string $hash Hash
* @param string $name Name
* @param string $value Value
* @param string $hash Hash
* @param bool $overwrite Boolean
*
* @return string Previous value
Expand Down Expand Up @@ -517,8 +517,8 @@ public static function get($hash = 'default', $mask = 0)
/**
* Sets a request variable
*
* @param array $array An associative array of key-value pairs
* @param string $hash The request variable to set (POST, GET, FILES, METHOD)
* @param array $array An associative array of key-value pairs
* @param string $hash The request variable to set (POST, GET, FILES, METHOD)
* @param bool $overwrite If true and an existing key is found, the value is overwritten,
* otherwise it is ignored
*
Expand Down

0 comments on commit b46b280

Please sign in to comment.