Showing 129 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
Function httpRedirect
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function httpRedirect($url = "", $postData = [], $serialize = true) {
if (preg_match("#^http[s]?://.+#", $url)) { // absolute url
if (function_exists("http_redirect")) {
http_redirect($url);
} else {
- 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 getBouncedEmails
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function getBouncedEmails($delete = true, $number = null) {
$emails = [];
for ($i = 1; (is_null($number) ? true : $i <= $number); $i++) {
$message = $this->getMessage($i);
- 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 _get
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function _get($ip, $type, $provider) {
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
throw new LocationDetectorException("Invalid IP address.");
}
Function go
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function go($debug = false) {
switch ($this->dbQuery->getType()) {
case (DBQueryType::SELECT):
$this->dbQuery->query = "SELECT * FROM " . static::TABLE_NAME;
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 unsetValueWithComplexName
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function unsetValueWithComplexName(&$array, $complexName) {
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
File DBObject.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Asymptix\db;
use Asymptix\core\Tools;
Function getSQLCondition
has a Cognitive Complexity of 18 (exceeds 5 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") {
- 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
Validator
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Validator {
/**
* Validate field value by regular expression.
*
Function getBrowserInfo
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getBrowserInfo() {
$browserFullName = $browserShortName = $browserVersion = null;
$userAgent = self::getUserAgent();
if (empty($userAgent)) {
- 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"