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
Function execute
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function execute()
{
if (!isset($this->eParamFILTERS) || !is_array($this->eParamFILTERS)) {
$this->eParamFILTERS = 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
Method processSendMailFilter
has 76 lines of code (exceeds 25 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']);
Method __doit
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __doit(array $fields = array(), XMLElement &$result, $position = null, $entry_id = null)
{
$post_values = new XMLElement('post-values');
if (!is_array($this->eParamFILTERS)) {
Function __doit
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function __doit(array $fields = array(), XMLElement &$result, $position = null, $entry_id = null)
{
$post_values = new XMLElement('post-values');
if (!is_array($this->eParamFILTERS)) {
- 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.event.section.php
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package events
*/
Method execute
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute()
{
if (!isset($this->eParamFILTERS) || !is_array($this->eParamFILTERS)) {
$this->eParamFILTERS = array();
}
Function appendErrors
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values)
{
$result->setAttribute('result', 'error');
$result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.'), array(
'message-id' => EventMessages::ENTRY_ERRORS
- 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 replaceFieldToken
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function replaceFieldToken($needle, $haystack, $default = null, $discard_field_name = true, $collapse = true)
{
if (preg_match('/^(fields\[[^\]]+\],?)+$/i', $needle)) {
$parts = preg_split('/\,/i', $needle, -1, PREG_SPLIT_NO_EMPTY);
$parts = array_map('trim', $parts);
- 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 processSendMailFilter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
Method replaceFieldToken
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function replaceFieldToken($needle, $haystack, $default = null, $discard_field_name = true, $collapse = true)
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;