Showing 720 of 720 total issues
File DBCore.php
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Asymptix\db;
use Asymptix\core\Tools;
Function http_response_code
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
function http_response_code($code = NULL) {
if ($code !== NULL) {
switch ($code) {
case 100: $text = 'Continue';
break;
- 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 setFieldsValues
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function setFieldsValues($valuesList) {
if (is_array($valuesList)) {
$count = 0;
foreach ($this->fieldsList as $fieldName => &$fieldValue) {
if (isset($valuesList[$fieldName])) {
- 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 setValueWithComplexName
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function setValueWithComplexName(&$array, $complexName, $value, $rewrite = false) {
if (!is_array($complexName)) {
$complexName = self::parseComplexName($complexName);
}
- 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 __construct
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(DBField $field, $conditionType, $value) {
$this->type = self::sqlConditionType($conditionType);
if (!Tools::isInstanceOf($value, "DBField")) {
$this->field = $field;
- 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
DBCore
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class DBCore {
/**
* An array containing all the opened connections.
*
* @var array
DBObject
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class DBObject extends \Asymptix\core\BasicObject {
/**
* Status constants.
*/
Function checkParameterTypes
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private static function checkParameterTypes($params, $types) {
if (count($params) != strlen($types)) {
throw new DBCoreException(
"Number of types is not equal parameters number"
);
- 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 __construct
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(DBField $field, $conditionType, $value) {
$this->type = self::sqlConditionType($conditionType);
if (!Tools::isInstanceOf($value, "DBField")) {
$this->field = $field;
Method http_response_code
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
function http_response_code($code = NULL) {
if ($code !== NULL) {
switch ($code) {
case 100: $text = 'Continue';
break;
Consider simplifying this complex logical expression. Open
if (strpos($type, "varchar") === 0
|| strpos($type, "text") === 0
|| strpos($type, "longtext") === 0
|| strpos($type, "enum") === 0
|| strpos($type, "char") === 0
The class Request has 12 public methods. Consider refactoring Request to keep number of public methods under 10. Open
class Request {
/**
* Check if form was submitted.
*
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Http has an overall complexity of 53 which is very high. The configured complexity threshold is 50. Open
class Http {
const POST = "POST";
const GET = "GET";
- Exclude checks
The class DBCore has 26 non-getter- and setter-methods. Consider refactoring DBCore to keep number of methods under 25. Open
class DBCore {
/**
* An array containing all the opened connections.
*
* @var array
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
The class DBCore has 23 public methods. Consider refactoring DBCore to keep number of public methods under 10. Open
class DBCore {
/**
* An array containing all the opened connections.
*
* @var array
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class DBSelector has 11 public methods. Consider refactoring DBSelector to keep number of public methods under 10. Open
class DBSelector extends \Asymptix\core\BasicObject {
protected $fieldsList = [
'conditions' => "",
'order' => "",
'offset' => 0,
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Validator has 20 public methods. Consider refactoring Validator to keep number of public methods under 10. Open
class Validator {
/**
* Validate field value by regular expression.
*
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Validator has an overall complexity of 54 which is very high. The configured complexity threshold is 50. Open
class Validator {
/**
* Validate field value by regular expression.
*
- Exclude checks
The class DBObject has 25 public methods. Consider refactoring DBObject to keep number of public methods under 10. Open
abstract class DBObject extends \Asymptix\core\BasicObject {
/**
* Status constants.
*/
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class DBObject has an overall complexity of 66 which is very high. The configured complexity threshold is 50. Open
abstract class DBObject extends \Asymptix\core\BasicObject {
/**
* Status constants.
*/
- Exclude checks