Showing 720 of 720 total issues
Avoid using undefined variables such as '$field' which will lead to PHP notices. Open
$fieldsList[$field] = [
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$extra' which will lead to PHP notices. Open
'extra' => $extra,
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$type' which will lead to PHP notices. Open
$field, $type, $collation, $null, $key, $default, $extra, $privileges, $comment
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$key' which will lead to PHP notices. Open
'key' => $key,
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$key' which will lead to PHP notices. Open
$field, $type, $collation, $null, $key, $default, $extra, $privileges, $comment
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$field' which will lead to PHP notices. Open
$field, $type, $collation, $null, $key, $default, $extra, $privileges, $comment
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$type' which will lead to PHP notices. Open
'type' => $type,
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$comment' which will lead to PHP notices. Open
'comment' => $comment
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Method getLanguages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getLanguages() {
if (is_null(self::$langs)) {
self::$langs = [
'en' => new Language('en', [
'en' => "English",
Method getSQLCondition
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSQLCondition($queryCondition, $operator = "") {
$operator = strtoupper(trim($operator));
if ($operator === "OR" || $operator === "AND") {
if (is_array($queryCondition)) {
if ($operator === "AND") {
Method start
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function start() {
switch ($this->direction) {
case (self::TO_OUTPUT_STREAM):
OutputStream::start();
Function checkAccountAccess
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function checkAccountAccess($roles = array()) {
global $_USER;
if (self::checkLoggedIn()) {
if (empty($roles)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function prepareLimit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function prepareLimit() {
$count = null;
if (!is_null($this->limit)) {
if (Tools::isInteger($this->limit)) {
$this->query.= " LIMIT " . $this->limit;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function css
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function css($propertyName, $propertyValue = null) {
if (is_null($propertyValue)) {
if (isset($this->style[$propertyName])) {
return $this->style[$propertyName];
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method sqlConditionType
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function sqlConditionType($conditionType) {
$conditionType = preg_replace("#[[:blank:]]{2,}#", " ", strtolower(trim($conditionType)));
$conditionTypes = [
// Equal operator
Method getPrintableSQLValue
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getPrintableSQLValue($type, $value) {
if (strpos($type, "varchar") === 0
|| strpos($type, "text") === 0
|| strpos($type, "longtext") === 0
|| strpos($type, "enum") === 0
Method castFieldValue
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function castFieldValue($fieldName, $type) {
global $_FIELDS;
if (isset($_FIELDS[$fieldName])) {
switch ($type) {
Method open
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function open($host = "localhost", $port = 110, $username = "", $password = "") {
$sock = fsockopen($host, $port);
if ($sock) {
fgets($sock, 1024);
Method showQueryDebugInfo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function showQueryDebugInfo($query = "", $types = "", array $params = []) {
OutputStream::start();
if (!empty($query)) {
if (empty($types) && empty($params)) {
OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query);
Method start
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function start($name = "", array $iniSettings = [], $useCookie = false,
$lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
{
if (!empty($iniSettings)) {
foreach ($iniSettings as $key => $value) {