Showing 714 of 844 total issues
Function renderText
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected static function renderText($e)
{
$message = $e->getMessage() . ($e->getPrevious()
? PHP_EOL . __('Previous exception: ') . $e->getPrevious()->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 convertToXML
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function convertToXML($json, $standalone = true)
{
self::$dom = new DOMDocument('1.0', 'utf-8');
self::$dom->formatOutput = 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
Avoid deeply nested control flow statements. Open
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $position => $data) {
if (isset($data['id'])) {
$id_list[] = (int)$data['id'];
}
Function buildTableHeaders
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function buildTableHeaders($columns, $sort, $order, $extra_url_params = null)
{
$aTableHead = array();
foreach ($columns as $c) {
- 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 (!empty($id_list)) {
$missing_cfs->where(['id' => ['not in' => $id_list]]);
}
Avoid deeply nested control flow statements. Open
if ($newField) {
$field->set('id', false);
}
Avoid deeply nested control flow statements. Open
if (!empty($entry_ids)) {
$pagination->entries($entry_ids);
}
Function __actionEdit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __actionEdit()
{
if (array_key_exists('save', $_POST['action'])) {
return $this->__formAction();
} elseif (array_key_exists('delete', $_POST['action'])) {
- 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 (is_array($missing_cfs) && !empty($missing_cfs)) {
foreach ($missing_cfs as $id) {
FieldManager::delete($id);
}
}
Avoid deeply nested control flow statements. Open
if ($field_id) {
if ($newField) {
/**
* After creation of a Field.
*
Function parseContext
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parseContext(array &$context, array $parts)
{
if (isset($parts[1])) {
if ($parts[1] === 'retrieve-password') {
$context['action'] = $parts[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
Consider simplifying this complex logical expression. Open
if(
(context.top >= 0 && context.top <= windowHeight) || // Element top in sight
(context.bottom >= 0 && context.bottom <= windowHeight) || // Element bottom in sight
(context.top <= 0 && context.bottom >= windowHeight) // Element overflowing viewport
) {
Consider simplifying this complex logical expression. Open
if (path && route) {
var contextId = (path + route).split('/').filter(function(part) {
return (part != 'edit' && part != 'new' && part != 'created' && part != 'saved' && part != '');
}).join('.');
Symphony.Context.add('context-id', contextId);
Consider simplifying this complex logical expression. Open
if (
($file == '.' || $file === '..')
|| ($ignore_hidden && $file{0} === '.')
|| in_array($file, $exclude)
|| in_array("$dir/$file", $exclude)
Consider simplifying this complex logical expression. Open
if (!isset($item_limit) || $item_limit === 'author') {
$can_access = true;
} elseif ($item_limit === 'developer' && Symphony::Author()->isDeveloper()) {
$can_access = true;
} elseif ($item_limit === 'manager' && (Symphony::Author()->isManager() || Symphony::Author()->isDeveloper())) {
Consider simplifying this complex logical expression. Open
if (48 <= $ascii && $ascii <= 57 || 65 <= $ascii && $ascii <= 90 || 97 <= $ascii && $ascii <= 122) {
$replace_length = 1;
$replace_char = $char;
// Encode space as underscore (means better readability for humans)
Method displayDatasourceFilterPanel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function displayDatasourceFilterPanel(XMLElement &$wrapper, $data = null, $errors = null, $fieldnamePrefix = null, $fieldnamePostfix = null)
Method buildValidationSelect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function buildValidationSelect(XMLElement &$wrapper, $selected = null, $name = 'fields[validator]', $type = 'input', array $errors = null)
Method processRawFieldData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null)
Method appendFormattedElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null)