Showing 4,334 of 7,873 total issues
Function getRootNodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getRootNodes(array $map) {
$elementType = ucfirst($map[0]);
$nodes = array();
/* Templates */
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function process($value,array $params = array()) {
$value= $this->tv->parseInput($value);
$format= !empty($params['format']) ? strtolower($params['format']) : '';
switch ($format) {
case 'upper case':
- 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 cleanupStaticFiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function cleanupStaticFiles() {
if ($this->isStaticFilesAutomated()) {
/* Remove file. */
$count = $this->modx->getCount($this->classKey, array('static_file' => $this->staticFile));
if ($this->staticFilePath && $count === 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 getResource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getResource() {
$resourceId = $this->getProperty('resource',0);
if (empty($resourceId)) {
$this->resource = $this->modx->newObject('modResource');
$this->resource->set('id',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 setLexiconEntries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setLexiconEntries(array $fields) {
/* set lexicon name/description */
if (!empty($fields['name'])) {
/** @var modLexiconEntry $entry */
$entry = $this->modx->getObject('modLexiconEntry',array(
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
if ($this->getProperty('enabled')) {
$this->object->set('priority', (int)$this->getProperty('priority', 0));
$this->object->set('propertyset', (int)$this->getProperty('propertyset', 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 process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function process($value, array $params = array())
{
$value = is_array($value) ? $value : explode(',', $value);
$options = array();
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function process($value,array $params = array()) {
$this->modx->getService('fileHandler','modFileHandler', '', array('context' => $this->modx->context->get('key')));
/** @var modMediaSource $source */
$source = $this->tv->getSource($this->modx->resource->get('context_key'));
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function fixParents() {
$autoIsFolder = $this->modx->getOption('auto_isfolder', null, true);
if (!$autoIsFolder) return;
if (!empty($this->oldParent)) {
- 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 saveEvents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function saveEvents() {
$events = $this->getProperty('events',null);
if ($events != null) {
$events = is_array($events) ? $events : $this->modx->fromJSON($events);
foreach ($events as $id => $event) {
- 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 prepareRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function prepareRow(xPDOObject $object) {
$canEdit = $this->modx->hasPermission('source_edit');
$canSave = $this->modx->hasPermission('source_save');
$canRemove = $this->modx->hasPermission('source_delete');
- 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 checkForUnPublishOnSiteStart
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function checkForUnPublishOnSiteStart() {
$passed = true;
$published = $this->getProperty('published',null);
$publishDate = $this->getProperty('pub_date');
$unPublishDate = $this->getProperty('unpub_date');
- 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 setSystemEvents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setSystemEvents() {
$events = $this->getProperty('events',null);
if ($events !== null) {
$pluginEvents = is_array($events) ? $events : $this->modx->fromJSON($events);
foreach ($pluginEvents as $id => $event) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
if (!$this->object) {
$this->element->setProperties($this->getData());
$this->element->save();
} 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 addElementCategoriesViaWizard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function addElementCategoriesViaWizard($categoryNames,array $contexts) {
$categoryNames = is_array($categoryNames) ? $categoryNames : explode(',',$categoryNames);
$categoryNames = array_unique($categoryNames);
/** @var modAccessPolicy $policy */
- 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 beforeSave
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function beforeSave() {
$policy = $this->modx->getObject('modAccessPolicy', $this->getProperty('policy'));
if (!$policy) {
$this->addFieldError('policy', $this->modx->lexicon('access_policy_err_nf'));
}
- 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 fireOnBeforeLoginEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function fireOnBeforeLoginEvent() {
$onBeforeLoginParams = array(
'username' => $this->username,
'password' => $this->givenPassword,
'attributes' => array(
- 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 setContexts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setContexts() {
$contexts = $this->getProperty('contexts');
$access = array();
if (!empty($contexts)) {
$contexts = is_array($contexts) ? $contexts : $this->modx->fromJSON($contexts);
- 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 addResourceGroupsViaWizard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function addResourceGroupsViaWizard($resourceGroupNames,array $contexts) {
$resourceGroupNames = is_array($resourceGroupNames) ? $resourceGroupNames : explode(',',$resourceGroupNames);
$resourceGroupNames = array_unique($resourceGroupNames);
/** @var modAccessPolicy $policy */
- 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 setResourceGroups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setResourceGroups() {
$resourceGroups = $this->getProperty('resource_groups');
$access = array();
if (!empty($resourceGroups)) {
$resourceGroups = is_array($resourceGroups) ? $resourceGroups : $this->modx->fromJSON($resourceGroups);
- 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"