conf/Config.php
getDBConfig accesses the super-global variable $_SERVER. Open
Open
public static function getDBConfig() {
if (isset($_SERVER['HTTP_HOST']) && isset(self::$db[$_SERVER['HTTP_HOST']])) {
return self::$db[$_SERVER['HTTP_HOST']];
}
return self::$db['default'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
getDBConfig accesses the super-global variable $_SERVER. Open
Open
public static function getDBConfig() {
if (isset($_SERVER['HTTP_HOST']) && isset(self::$db[$_SERVER['HTTP_HOST']])) {
return self::$db[$_SERVER['HTTP_HOST']];
}
return self::$db['default'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isDevServer accesses the super-global variable $_SERVER. Open
Open
public static function isDevServer() {
return ($_SERVER['SERVER_ADDR'] == '127.0.0.1');
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
getDBConfig accesses the super-global variable $_SERVER. Open
Open
public static function getDBConfig() {
if (isset($_SERVER['HTTP_HOST']) && isset(self::$db[$_SERVER['HTTP_HOST']])) {
return self::$db[$_SERVER['HTTP_HOST']];
}
return self::$db['default'];
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Avoid variables with short names like $db. Configured minimum length is 3. Open
Open
public static $db = [
'default' => [
'HOST' => "localhost",
'DBNAME' => "dbname",
'USER' => "root",
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}