diff --git a/src/Request.php b/src/Request.php index d7888c2..471ce7e 100644 --- a/src/Request.php +++ b/src/Request.php @@ -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); @@ -111,18 +111,18 @@ public static function getVar($name, $default = null, $hash = 'default', $type = break; } - if (isset($input[$name]) && $input[$name] !== null) { + if (isset($input[$name]) && null !== $input[$name]) { // Get the variable from the input hash and clean it $var = static::cleanVar($input[$name], $mask, $type); // Handle magic quotes compatibility if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() && ($var != $default) - && ($hash !== 'FILES') + && ('FILES' !== $hash) ) { $var = static::stripSlashesRecursive($var); } - } elseif ($default !== null) { + } elseif (null !== $default) { // Clean the default value $var = static::cleanVar($default, $mask, $type); } else { @@ -350,7 +350,7 @@ public static function getHeader($headerName, $default = '') } else { // From joyview - http://php.net/manual/en/function.getallheaders.php foreach ($_SERVER as $name => $value) { - if (substr($name, 0, 5) === 'HTTP_') { + if ('HTTP_' === substr($name, 0, 5)) { $translatedName = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($name, 5)))); $headers[$translatedName] = $value; } @@ -376,7 +376,7 @@ public static function getHeader($headerName, $default = '') public static function hasVar($name, $hash = 'default') { $hash = strtoupper($hash); - if ($hash === 'METHOD') { + if ('METHOD' === $hash) { $hash = strtoupper($_SERVER['REQUEST_METHOD']); } @@ -401,7 +401,7 @@ public static function hasVar($name, $hash = 'default') public static function setVar($name, $value = null, $hash = 'method', $overwrite = true) { $hash = strtoupper($hash); - if ($hash === 'METHOD') { + if ('METHOD' === $hash) { $hash = strtoupper($_SERVER['REQUEST_METHOD']); } @@ -475,7 +475,7 @@ public static function get($hash = 'default', $mask = 0) { $hash = strtoupper($hash); - if ($hash === 'METHOD') { + if ('METHOD' === $hash) { $hash = strtoupper($_SERVER['REQUEST_METHOD']); } @@ -504,7 +504,7 @@ public static function get($hash = 'default', $mask = 0) } // Handle magic quotes compatibility - if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() && ($hash !== 'FILES')) { + if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() && ('FILES' !== $hash)) { $input = static::stripSlashesRecursive($input); } @@ -552,7 +552,7 @@ protected static function cleanVar($var, $mask = 0, $type = null) static $safeHtmlFilter = null; // convert $var in array if $type is ARRAY - if (strtolower((string)$type) === 'array' && !is_array($var)) { + if ('array' === strtolower((string)$type) && !is_array($var)) { $var = array($var); }