Showing 7,873 of 7,873 total issues
Function setOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setOptions($ch,array $options = array()) {
/* always return us the result */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, !empty($options['curlopt_returntransfer']) ? $options['curlopt_returntransfer'] : 1);
/* we dont want header gruft */
curl_setopt($ch, CURLOPT_HEADER, !empty($options['curlopt_header']) ? $options['curlopt_header'] : 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
Avoid deeply nested control flow statements. Open
if (!$isAbsolute) {
$value = $source->prepareOutputUrl($value);
}
Method getRender
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getRender($params,$value,array $paths,$method,$resourceId = 0,$type = 'text') {
Function _parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function _parse($result) {
$headers = array();
$httpVer = strtok($result, "\n");
while($line = strtok("\n")){
- 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 outputContent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function outputContent(array $options = array()) {
$route = $this->modx->request->action;
$this->namespace = $this->modx->request->namespace;
if (empty($route)) {
$route = $this->namespace == 'core' ? 'welcome' : 'index';
- 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 (!$isForward || ($isForward && !$this->modx->getOption('allow_forward_across_contexts', $options, false))) {
if (!$this->modx->getCount('modContextResource', array($this->modx->context->get('key'), $resourceId))) {
return null;
}
}
Method _log
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function _log($level, $msg, $target= '', $def= '', $file= '', $line= '') {
Function sendError
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function sendError($type = '', $options = array()) {
if (!is_string($type) || empty($type)) $type = $this->getOption('error_type', $options, 'unavailable');
while (ob_get_level() && @ob_end_clean()) {}
if (!XPDO_CLI_MODE) {
$errorPageTitle = $this->getOption('error_pagetitle', $options, 'Error 503: Service temporarily unavailable');
- 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 ($resource) {
$this->_output = $resource;
}
Avoid deeply nested control flow statements. Open
if (array_key_exists('use_weblink_target', $this->_properties)) {
$options['use_weblink_target'] = $this->_properties['use_weblink_target'];
unset($this->_properties['use_weblink_target']);
}
Function regClientStartupScript
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function regClientStartupScript($src, $plaintext= false) {
if (!empty ($src) && !array_key_exists($src, $this->loadedjscripts)) {
if (isset ($this->loadedjscripts[$src]))
return;
$this->loadedjscripts[$src]= 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
Function checkValidation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function checkValidation($objs= array()) {
if (is_object($objs)) {
$this->addObjectToValidate($objs);
}
else if (is_array($objs) && !empty($objs)) {
- 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
Method listEvents
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function listEvents(xPDO &$xpdo, $plugin, array $criteria = array(), array $sort = array('id' => 'ASC'), $limit = 0, $offset = 0) {
Avoid deeply nested control flow statements. Open
if (array_key_exists('scheme', $this->_properties)) {
$scheme = $this->_properties['scheme'];
unset($this->_properties['scheme']);
if (is_numeric($scheme)) $scheme = (integer) $scheme;
}
Function removeExtensionPackage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function removeExtensionPackage($name) {
/** @var modSystemSetting $setting */
$setting = $this->getObject('modSystemSetting',array(
'key' => 'extension_packages',
));
- 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 (array_key_exists('context', $this->_properties)) {
$context = $this->_properties['context'];
unset($this->_properties['context']);
}
Avoid deeply nested control flow statements. Open
if (in_array($propertyKey, array('context', 'scheme', 'use_weblink_target'))) continue;
Method getValidMessages
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function getValidMessages(modDbRegister &$register, $topic, $topicBase, $topicMsg, $limit, array $options = array()) {
Avoid deeply nested control flow statements. Open
if ($applicablePolicy['principal'] == $principalId) {
if ($principalAuthority <= $applicablePolicy['authority']) {
if (!$applicablePolicy['policy']) {
return true;
}
Function initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function initialize() {
$primaryKey = $this->getProperty($this->primaryKeyField, false);
if (empty($primaryKey)) {
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"