Showing 129 of 720 total issues
Function sqlPushValues
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function sqlPushValues($values, $separator = ", ") {
$chunks = [];
foreach ($values as $fieldName => $fieldValue) {
if (!is_array($fieldValue)) {
if (!is_null($fieldValue)) {
- 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 __call
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __call($methodName, $methodParams) {
/*
* Selects DBObject record by some field value.
*
* @param <mixed> Value of the 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
Function localize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function localize($value = "") {
$localizedValue = Languages::$langs;
if (is_array($value)) {
foreach ($localizedValue as $langKey => &$lValue) {
if (isset($value[$langKey])) {
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($optionValue, $option, $currentValue, $template = "") {
if (empty($template)) {
$template = self::DEFAULT_TEMPLATE;
}
if (isObject($option)) {
Method getRedirectUrl
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getRedirectUrl($url) {
$urlParts = @parse_url($url);
if (!$urlParts) {
return false;
}
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 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();
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") {
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
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 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
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 secondsToTime
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function secondsToTime($inputSeconds, $format = self::HUMAN_FORMAT_DEFAULT) {
$secondsInAMinute = 60;
$secondsInAnHour = 60 * $secondsInAMinute;
$secondsInADay = 24 * $secondsInAnHour;
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) {
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 start
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function start($name = "", array $iniSettings = [], $useCookie = false,
$lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
Function log
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function log($type, $message, $format = "\[Y-m-d H:i:s\]", $time = null) {
$msgType = null;
switch ($type) {
case (self::LOG_INFO):
$msgType = OutputStream::MSG_INFO;
- 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"