Showing 7,873 of 7,873 total issues
Function restore
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function restore($revisions= array (), $restore= 0) {
reset($revisions);
$restored= current($revisions);
if ($restore && next($revisions)) {
while (list($k, $v)= each($revisions)) {
- 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 getTables
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getTables() {
$c = new xPDOCriteria($this->modx, "select [name] from sys.Tables where [type] = 'U' ORDER BY [name]");
$c->stmt->execute();
$table_names = $c->stmt->fetchAll(PDO::FETCH_COLUMN);
- 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 moveObject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function moveObject($from,$to,$point = 'append') {
$this->xpdo->lexicon->load('source');
$success = false;
if (substr(strrev($from),0,1) == '/') {
- 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 getTables
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getTables() {
$c = new xPDOCriteria($this->modx, 'SHOW TABLE STATUS FROM '.$this->modx->escape($this->modx->getOption('dbname')));
$c->stmt->execute();
$dt = array();
while ($row= $c->stmt->fetch(PDO::FETCH_ASSOC)) {
- 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 checkParentPermissions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function checkParentPermissions() {
$parent = null;
$parentId = intval($this->getProperty('parent'));
if ($parentId > 0) {
$this->parentResource = $this->modx->getObject('modResource',$parentId);
- 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 clearCache
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function clearCache(array $options = array()) {
/** @var modCacheManager $cacheManager */
$cacheManager = $this->xpdo->getCacheManager();
if (empty($cacheManager)) return;
- 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 optimize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function optimize() {
$stmt = $this->modx->query('SHOW TABLES');
if ($stmt && $stmt instanceof PDOStatement) {
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
if (!empty($row[0])) {
- 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 parseArray
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function parseArray($needle,array $haystack = array()) {
if (!is_array($haystack)) return false;
$results = array();
foreach($haystack as $key=>$value) {
if (strpos($key, $needle)!==false || strpos($value,$needle) !== false) {
- 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() {
$where = array(
'namespace' => $this->getProperty('namespace'),
'topic' => $this->getProperty('topic'),
'language' => $this->getProperty('language'),
- 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 hasAccess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function hasAccess($user = null,$context = '') {
/** @var modUser $user */
$user = !empty($user) ? $user : $this->xpdo->user;
if (is_object($context)) $context = $context->get('key');
$resourceGroups = $user->getResourceGroups($context);
- 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 afterSave
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function afterSave() {
/* if changing key */
if ($this->isRename) {
$newName = $this->getProperty('newName');
if ($this->doesAlreadyExist(array('text' => $newName))) {
- 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() {
$this->getRootNode();
$this->prepare();
if (empty($this->contextKey) || $this->contextKey == 'root') {
- 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 fixParents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function fixParents($node) {
$nodeObject = $this->modx->getObject('modResource', $node->id);
/** @var modResource $oldParent */
$oldParent = $this->modx->getObject('modResource', $nodeObject->parent);
- 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($featureItem)) { continue; }
Function process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
$o = @file_get_contents($this->file['tmp_name']);
if (empty($o)) {
return $this->failure($this->modx->lexicon('properties_import_err_upload'));
}
- 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 checkPublishedOn
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function checkPublishedOn() {
$published = $this->getProperty('published',null);
if ($published !== null && $published != $this->object->get('published')) {
if (empty($published)) { /* if unpublishing */
$this->setProperty('publishedon',0);
- 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 getRenderOutput
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getRenderOutput(array $renderDirectories) {
$o = '';
foreach ($renderDirectories as $renderDirectory) {
if (empty($renderDirectory) || !is_dir($renderDirectory)) continue;
- 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 sort
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function sort(){
if (($this->source instanceof modContext) && ($this->target instanceof modContext)) {
return $this->sortContexts();
}
- 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 beforeRemove
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function beforeRemove() {
/* check to make sure it doesn't have any resources using it */
$resources = $this->modx->getCollection('modResource',array(
'deleted' => 0,
'template' => $this->object->get('id'),
- 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 getCategoryNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getCategoryNode($category) {
$list = array();
$c = $this->modx->newQuery($this->classKey);
$c->where(array('category' => $category));
- 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"