Showing 844 of 844 total issues
Function processParametersInString
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function processParametersInString($value, array $env, $includeParenthesis = true, $escape = false)
{
if (trim($value) == '') {
return 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
Method execute
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute(array &$param_pool = null)
{
$authorsQuery = (new AuthorManager)
->select()
->sort((string)$this->dsParamSORT, $this->dsParamORDER);
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function parseContext(array &$context, array $parts)
{
// Order is important!
$params = array_fill_keys(array('action', 'id', 'flag'), null);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 174.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function parseContext(array &$context, array $parts)
{
// Order is important!
$params = array_fill_keys(array('action', 'id', 'flag'), null);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 174.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function processRawFieldData
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null)
{
$status = self::__OK__;
// No file given, save empty data:
- 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 processParameters
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function processParameters(array $env = null)
{
if ($env) {
$this->_env = $env;
}
- 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 Filtering
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
Symphony.Interface.Filtering = function() {
var filtering, duplicator, apply,
actions = [];
/**
Method viewConfiguration
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function viewConfiguration()
{
// Populating fields array
$fields = isset($_POST['fields']) ? $_POST['fields'] : $this->params['default-config'];
File class.entryquery.php
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package toolkit
*/
DatabaseStatement
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class DatabaseStatement
{
/**
* List of element delimiter
* @var string
AdministrationPage
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class AdministrationPage extends HTMLPage
{
/**
* An array of `Alert` objects used to display page level
* messages to Symphony backend users one by one. Prior to Symphony 2.3
File class.entrymanager.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package toolkit
*/
Function processSendMailFilter
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
{
$fields['recipient'] = self::replaceFieldToken($send_email['recipient'], $fields);
$fields['recipient'] = preg_split('/\,/i', $fields['recipient'], -1, PREG_SPLIT_NO_EMPTY);
$fields['recipient'] = array_map('trim', $fields['recipient']);
- 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 class.fieldmanager.php
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package toolkit
*/
PageManager
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class PageManager
{
/**
* Given an associative array of data, where the key is the column name
* in `tbl_pages` and the value is the data, this function will create a new
Function resolvePage
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function resolvePage($page = null)
{
if ($page) {
$this->_page = $page;
}
- 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 listStructure
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public static function listStructure($dir = ".", $filters = array(), $recurse = true, $sort = "asc", $strip_root = null, $exclude = array(), $ignore_hidden = true)
{
if (!is_dir($dir)) {
return 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 getPageCallback
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function getPageCallback($page = null)
{
if (!$page && $this->_callback) {
return $this->_callback;
} elseif (!$page && !$this->_callback) {
- 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 __viewIndex
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Pages'), __('Symphony'))));
- 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 checkConfiguration
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkConfiguration()
{
$db = null;
$errors = [];
$fields = $this->extendDatabaseFields(self::$POST['fields']);