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($properties= null, $content= null) {
parent :: process($properties, $content);
if (!$this->_processed) {
$this->_output= $this->_content;
if ($this->_output !== null && is_string($this->_output) && !empty($this->_output)) {
- 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
function __construct(modX &$modx) {
$this->modx= & $modx;
$gcMaxlifetime = (integer) $this->modx->getOption('session_gc_maxlifetime');
if ($gcMaxlifetime > 0) {
$this->gcMaxLifetime= $gcMaxlifetime;
- 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 _loadExtensionPackages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function _loadExtensionPackages($options = null) {
$cache = $this->call('modExtensionPackage','loadCache',array(&$this));
if (!empty($cache)) {
foreach ($cache as $package) {
$package['table_prefix'] = isset($package['table_prefix']) ? $package['table_prefix'] : null;
- 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 getRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getRequest($class= 'modRequest', $path= '') {
if ($this->request === null || !($this->request instanceof modRequest)) {
$requestClass = $this->getOption('modRequest.class',$this->config,$class);
if ($requestClass !== $class) {
$this->loadClass('modRequest', '', false, 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 getLoginUserID
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getLoginUserID($context= '') {
$userId = 0;
if (empty($context) && $this->context instanceof modContext && $this->user instanceof modUser) {
if ($this->user->hasSessionContext($this->context->get('key'))) {
$userId = $this->user->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 setObjectFields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setObjectFields(&$object,array $values = array()) {
foreach ($values as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
$object->{$key[$k]} = $v;
- 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 getAllErrors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAllErrors($fieldErrorSeparator = ': ') {
$errormsgs = array();
if ($this->hasMessage()) {
$errormsgs[] = $this->getMessage();
}
- 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 checkRequiredRelatedObjects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function checkRequiredRelatedObjects(array $pairs = array()) {
$passed = true;
foreach ($pairs as $field => $classKey) {
if (!empty($classKey) && !empty($field)) {
$relatedObject = $this->modx->getObject($classKey,$this->getProperty($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 refreshURIs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function refreshURIs(modX &$modx, $parent = 0, array $options = array()) {
$resetOverrides = array_key_exists('resetOverrides', $options) ? (boolean) $options['resetOverrides'] : false;
$contexts = array_key_exists('contexts', $options) ? explode(',', $options['contexts']) : null;
$criteria = $modx->newQuery('modResource', array('parent' => $parent));
if (!$resetOverrides) {
- 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 setCssURLPlaceholders
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setCssURLPlaceholders()
{
$managerUrl = $this->modx->getOption('manager_url', null, MODX_MANAGER_URL);
$managerPath = $this->modx->getOption('manager_path',null,MODX_MANAGER_PATH);
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function save($cacheFlag = null) {
$isNew = $this->isNew();
if ($this->xpdo instanceof modX) {
$this->xpdo->invokeEvent('OnPluginBeforeSave',array(
'mode' => $isNew ? modSystemEvent::MODE_NEW : modSystemEvent::MODE_UPD,
- 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 _loadInstance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function _loadInstance(& $xpdo, $className, $criteria, $row) {
/** @var modAccessibleObject $instance */
$instance = xPDOObject :: _loadInstance($xpdo, $className, $criteria, $row);
if ($instance instanceof modAccessibleObject && !$instance->checkPolicy('load')) {
if ($xpdo instanceof modX) {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
/* Run the beforeSet method before setting the fields, and allow stoppage */
$canSave = $this->beforeSet();
if ($canSave !== true) {
return $this->failure($canSave);
- 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 hasTemplateVar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function hasTemplateVar($tvPk) {
if (!is_int($tvPk) && !is_object($tvPk)) {
$tv = $this->xpdo->getObject('modTemplateVar',array('name' => $tvPk));
if (empty($tv) || !is_object($tv) || !($tv instanceof modTemplateVar)) {
$this->xpdo->log(modX::LOG_LEVEL_ERROR,'modTemplate::hasTemplateVar - No TV: '.$tvPk);
- 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_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process_response($curl_handle = null, $response = null)
{
// Accept a custom one if it's passed.
if ($curl_handle && $response)
{
- 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 dumpArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static protected function dumpArray($value)
{
// array
$keys = array_keys($value);
if (
- 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 create_bucket
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function create_bucket($bucket, $region, $acl = self::ACL_PRIVATE, $opt = null)
{
// If the bucket contains uppercase letters...
if (preg_match('/[A-Z]/', $bucket))
{
- 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 set_cache_config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function set_cache_config($location, $gzip = true)
{
// If we have an array, we're probably passing in Memcached servers and ports.
if (is_array($location))
{
- 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 load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static public function load($value)
{
$value = trim($value);
if (0 == strlen($value))
- 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 compileCheckPlugins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function compileCheckPlugins($requiredPlugins)
{
if (!empty($requiredPlugins)) {
$plugins = array();
foreach ($requiredPlugins as $plugin) {
- 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"