Skip to content

Commit 4116726

Browse files
committed
Yoda consistency
1 parent d2f1447 commit 4116726

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Request.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static function getVar($name, $default = null, $hash = 'default', $type =
8181
{
8282
// Ensure hash and type are uppercase
8383
$hash = strtoupper($hash);
84-
if ($hash === 'METHOD') {
84+
if ('METHOD' === $hash) {
8585
$hash = static::getMethod();
8686
}
8787
$type = strtoupper($type);
@@ -111,18 +111,18 @@ public static function getVar($name, $default = null, $hash = 'default', $type =
111111
break;
112112
}
113113

114-
if (isset($input[$name]) && $input[$name] !== null) {
114+
if (isset($input[$name]) && null !== $input[$name]) {
115115
// Get the variable from the input hash and clean it
116116
$var = static::cleanVar($input[$name], $mask, $type);
117117

118118
// Handle magic quotes compatibility
119119
if (function_exists('get_magic_quotes_gpc')
120120
&& @get_magic_quotes_gpc() && ($var != $default)
121-
&& ($hash !== 'FILES')
121+
&& ('FILES' !== $hash)
122122
) {
123123
$var = static::stripSlashesRecursive($var);
124124
}
125-
} elseif ($default !== null) {
125+
} elseif (null !== $default) {
126126
// Clean the default value
127127
$var = static::cleanVar($default, $mask, $type);
128128
} else {
@@ -350,7 +350,7 @@ public static function getHeader($headerName, $default = '')
350350
} else {
351351
// From joyview - http://php.net/manual/en/function.getallheaders.php
352352
foreach ($_SERVER as $name => $value) {
353-
if (substr($name, 0, 5) === 'HTTP_') {
353+
if ('HTTP_' === substr($name, 0, 5)) {
354354
$translatedName = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($name, 5))));
355355
$headers[$translatedName] = $value;
356356
}
@@ -376,7 +376,7 @@ public static function getHeader($headerName, $default = '')
376376
public static function hasVar($name, $hash = 'default')
377377
{
378378
$hash = strtoupper($hash);
379-
if ($hash === 'METHOD') {
379+
if ('METHOD' === $hash) {
380380
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
381381
}
382382

@@ -401,7 +401,7 @@ public static function hasVar($name, $hash = 'default')
401401
public static function setVar($name, $value = null, $hash = 'method', $overwrite = true)
402402
{
403403
$hash = strtoupper($hash);
404-
if ($hash === 'METHOD') {
404+
if ('METHOD' === $hash) {
405405
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
406406
}
407407

@@ -475,7 +475,7 @@ public static function get($hash = 'default', $mask = 0)
475475
{
476476
$hash = strtoupper($hash);
477477

478-
if ($hash === 'METHOD') {
478+
if ('METHOD' === $hash) {
479479
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
480480
}
481481

@@ -504,7 +504,7 @@ public static function get($hash = 'default', $mask = 0)
504504
}
505505

506506
// Handle magic quotes compatibility
507-
if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() && ($hash !== 'FILES')) {
507+
if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() && ('FILES' !== $hash)) {
508508
$input = static::stripSlashesRecursive($input);
509509
}
510510

@@ -552,7 +552,7 @@ protected static function cleanVar($var, $mask = 0, $type = null)
552552
static $safeHtmlFilter = null;
553553

554554
// convert $var in array if $type is ARRAY
555-
if (strtolower((string)$type) === 'array' && !is_array($var)) {
555+
if ('array' === strtolower((string)$type) && !is_array($var)) {
556556
$var = array($var);
557557
}
558558

0 commit comments

Comments
 (0)