Showing 7,873 of 7,873 total issues
Function getValidator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getValidator() {
if (!is_object($this->_validator)) {
$validatorClass = $this->xpdo->loadClass('validation.xPDOValidator', XPDO_CORE_PATH, true, true);
if ($derivedClass = $this->getOption(xPDO::OPT_VALIDATOR_CLASS, null, '')) {
if ($derivedClass = $this->xpdo->loadClass($derivedClass, '', false, true)) {
- 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
Avoid deeply nested control flow statements. Open
if (is_string($value)) {
$value= unserialize($value);
}
Function removeObjectContainer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function removeObjectContainer($className) {
$removed= false;
if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
$instance= $this->xpdo->newObject($className);
if ($instance) {
- 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
Avoid deeply nested control flow statements. Open
if (!empty($foreignCriteria)) {
$conditions = array($foreignCriteria, $conditions);
}
Avoid deeply nested control flow statements. Open
if (is_string($format) && !empty ($format)) {
if (strpos($format, 're:') === 0) {
if (!empty ($formatTemplate) && is_string($formatTemplate)) {
$value= preg_replace(substr($format, 3), $formatTemplate, $value);
}
Avoid deeply nested control flow statements. Open
if (in_array($childPK, $ancestors[$composite['class']])) {
continue;
}
Function removeField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function removeField($class, $name, array $options = array()) {
$result = false;
if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
$className = $this->xpdo->loadClass($class);
if ($className) {
- 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
Avoid deeply nested control flow statements. Open
if (is_array($fkMeta['criteria']['foreign'])) {
foreach ($fkMeta['criteria']['foreign'] as $critKey => $critVal) {
if (is_numeric($critKey)) {
$foreignCriteria[] = $critVal;
} else {
Avoid deeply nested control flow statements. Open
if ($ts !== false && !empty($value)) {
if (is_string($format) && !empty ($format)) {
if (strpos($format, 're:') === 0) {
$value= date('Y-m-d', $ts);
if (!empty ($formatTemplate) && is_string($formatTemplate)) {
Method getSelectColumns
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function getSelectColumns(xPDO & $xpdo, $className, $tableAlias= '', $columnPrefix= '', $columns= array (), $exclude= false) {
Avoid deeply nested control flow statements. Open
if (is_string($format) && !empty ($format)) {
if (strpos($format, 're:') === 0) {
if (!empty ($formatTemplate) && is_string($formatTemplate)) {
$value= preg_replace(substr($format, 3), $formatTemplate, $value);
}
Avoid deeply nested control flow statements. Open
if ($pkGenerated) {
$this->_fields[$this->getPK()]= $this->xpdo->lastInsertId();
}
Function removeIndex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function removeIndex($class, $name, array $options = array()) {
$result = false;
if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
$className = $this->xpdo->loadClass($class);
if ($className) {
- 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
Avoid deeply nested control flow statements. Open
if (is_array($childPK)) {
$childPK = implode('|', $childPK);
}
Avoid deeply nested control flow statements. Open
if (!empty($indexset)) {
switch ($indexType) {
case 'UNIQUE':
$createIndices[$indexkey] = "CREATE UNIQUE INDEX {$this->xpdo->escape($indexkey)} ON {$tableName} ({$indexset})";
break;
Function process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
$language = 'en';
$namespace = 'core';
$corePath = $this->modx->getOption('core_path',null,MODX_CORE_PATH);
- 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 privAddFileUsingTempFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
{
$v_result=PCLZIP_ERR_NO_ERROR;
// ----- Working variable
- 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 process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
$dashboards = $this->getProperty('dashboards',null);
if (empty($dashboards)) {
return $this->failure($this->modx->lexicon('dashboard_err_ns'));
- 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 process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
$widgets = $this->getProperty('widgets',null);
if (empty($widgets)) {
return $this->failure($this->modx->lexicon('widget_err_ns'));
- 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 beforeSet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function beforeSet() {
/* default settings */
$this->prepareParent();
if ($this->getProperty('parent') === (int) $this->modx->getOption('tree_root_id') && !$this->modx->hasPermission('new_document_in_root')) {
return $this->modx->lexicon('permission_denied');
- 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"