Showing 7,873 of 7,873 total issues
Function process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process(array $scriptProperties = array()) {
$placeholders = array();
/* load snippet */
if (empty($scriptProperties['id']) || strlen($scriptProperties['id']) !== strlen((integer)$scriptProperties['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 _compilePayload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function _compilePayload(& $transport) {
parent :: _compilePayload($transport);
$body = array ();
$cacheManager = $transport->xpdo->getCacheManager();
if ($cacheManager) {
- 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 writePreserved
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function writePreserved() {
$written = false;
if (!empty($this->_preserved)) {
$content = var_export($this->_preserved, true);
$cacheManager = $this->xpdo->getCacheManager();
- 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 refresh
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function refresh(array $providers = array(), array &$results = array()) {
if (empty($providers)) {
foreach ($this->caches as $cacheKey => $cache) {
$providers[$cacheKey] = 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 toJSON
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function toJSON($array) {
$encoded= '';
if (is_array ($array)) {
if (!function_exists('json_encode')) {
if (@ include_once (XPDO_CORE_PATH . 'json/JSON.php')) {
- 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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(& $xpdo, $sql= '', $bindings= array (), $cacheFlag= false) {
$this->xpdo= & $xpdo;
$this->cacheFlag= $cacheFlag;
if (is_string($sql) && !empty ($sql)) {
$this->sql= $sql;
- 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 parseDSN
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function parseDSN($string) {
$result= array ();
$pos= strpos($string, ':');
$result['dbtype']= strtolower(substr($string, 0, $pos));
$parameters= explode(';', substr($string, ($pos +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 getAncestry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAncestry($className, $includeSelf= true) {
$ancestry= array ();
if ($actualClassName= $this->loadClass($className)) {
$ancestor= $actualClassName;
if ($includeSelf) {
- 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 newObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function newObject($className, $fields= array ()) {
$instance= null;
if ($className= $this->loadClass($className)) {
$className .= '_' . $this->config['dbtype'];
if ($instance= new $className ($this)) {
- 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 removeValidationRules
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function removeValidationRules($field = null, array $rules = array()) {
if (!$this->_validationLoaded) $this->_loadValidation();
if (empty($rules) && is_string($field)) {
unset($this->_validationRules[$this->getField($field)]);
} elseif (empty($rules) && is_null($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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(& $xpdo, $class, $criteria= null) {
parent :: __construct($xpdo);
if ($class= $this->xpdo->loadClass($class)) {
$this->_class= $class;
$this->_alias= $class;
- 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 removeIndex
has a Cognitive Complexity of 7 (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
Function hydrateGraphParent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function hydrateGraphParent(& $instances, $row) {
$hydrated = false;
$instance = $this->xpdo->call($this->getClass(), '_loadInstance', array(& $this->xpdo, $this->getClass(), $this->getAlias(), $row));
if (is_object($instance)) {
$pk= $instance->getPrimaryKey();
- 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 addValidationRule
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addValidationRule($field, $name, $type, $rule, array $parameters= array()) {
$field = $this->getField($field);
if (is_string($field)) {
if (!$this->_validationLoaded) $this->_loadValidation();
if (!isset($this->_validationRules[$field])) $this->_validationRules[$field]= 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 _loadValidation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _loadValidation($reload= false) {
if (!$this->_validationLoaded || $reload == true) {
$validation= $this->xpdo->getValidationRules($this->_class);
$this->_validationLoaded= true;
foreach ($validation as $column => $rules) {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function moveObject($from,$to,$point = 'append') {
$success = false;
$fromBases = $this->getBases($from);
$toBases = $this->getBases($to);
- 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 formatDates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function formatDates(array &$resourceArray) {
$format = $this->modx->getOption('manager_date_format') .' '. $this->modx->getOption('manager_time_format');
if (!empty($resourceArray['pub_date']) && $resourceArray['pub_date'] != '0000-00-00 00:00:00') {
$resourceArray['pub_date'] = date($format, strtotime($resourceArray['pub_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 isValid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isValid($value, array $options = array()) {
if (!isset($options['alias'])) return false;
parent :: isValid($value, $options);
$result= false;
$obj=& $this->validator->object;
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function beforeSet() {
// Setup to allow PK change
$oldName = $this->getProperty('previous_text');
$newName = $this->getProperty('text');
if (empty($newName)) return $this->modx->lexicon($this->objectType.'_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 fireBeforeSaveEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function fireBeforeSaveEvent() {
/** @var array $OnBeforeDocFormSave */
$OnBeforeDocFormSave = $this->modx->invokeEvent('OnBeforeDocFormSave',array(
'mode' => modSystemEvent::MODE_NEW,
'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"