Function prepareResourceNode
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public function prepareResourceNode(modResource $resource) {
$qtipField = $this->getProperty('qtipField');
$nodeField = $this->getProperty('nodeField');
$nodeFieldFallback = $this->getProperty('nodeFieldFallback');
$noHref = $this->getProperty('noHref',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
File getnodes.class.php
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of MODX Revolution.
*
* Copyright (c) MODX, LLC. All Rights Reserved.
Method prepareResourceNode
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareResourceNode(modResource $resource) {
$qtipField = $this->getProperty('qtipField');
$nodeField = $this->getProperty('nodeField');
$nodeFieldFallback = $this->getProperty('nodeFieldFallback');
$noHref = $this->getProperty('noHref',false);
Method search
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($query) {
/* first check to see if search results */
$searchNode = array(
'text' => $this->modx->lexicon('search_results'),
'id' => 'search_results',
Method prepareContextNode
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareContextNode(modContext $context) {
$class = array('tree-pseudoroot-node');
$createRoot = $this->modx->hasPermission('new_document_in_root');
Method getResourceQuery
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getResourceQuery() {
$resourceColumns = array(
'id'
,'template'
,'pagetitle'
Function iterate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function iterate(array $collection = array()) {
/* now process actual tree nodes */
$item = reset($collection);
/** @var modContext|modResource $item */
while ($item) {
- 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"