Showing 714 of 844 total issues
Function filter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function filter(EntryQuery $query, array $filters, $operator = 'or')
{
General::ensureType([
'operator' => ['var' => $operator, 'type' => 'string'],
]);
- 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 isFieldHidden
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function isFieldHidden(Field $field)
{
if ($field->get('hide_when_prepopulated') == 'yes') {
if (isset($_REQUEST['prepopulate'])) {
foreach ($_REQUEST['prepopulate'] as $field_id => $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 view
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function view()
{
$handle = General::sanitize($_GET['handle']);
$section = General::sanitize($_GET['section']);
$options = 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 checkFields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkFields(array &$errors, $checkForDuplicates = true)
{
$parent_section = $this->get('parent_section');
$label = $this->get('label');
$element_name = $this->get('element_name');
Method generateNonce
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function generateNonce($length = 30)
{
$random = null;
if ($length < 1) {
throw new Exception('$length must be greater than 0');
Method validateXML
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validateXML($data, &$errors, $isFile = true, $xsltProcessor = null, $encoding = 'UTF-8')
{
$_data = ($isFile) ? file_get_contents($data) : $data;
$_data = preg_replace('/<!DOCTYPE[-.:"\'\/\\w\\s]+>/', null, $_data);
Method buildDSRetrievalSQL
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false)
{
if (Symphony::Log()) {
Symphony::Log()->pushDeprecateWarningToLog(
get_called_class() . '::buildDSRetrievalSQL()',
Method buildDSRetrievalSQL
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false)
{
if (Symphony::Log()) {
Symphony::Log()->pushDeprecateWarningToLog(
get_called_class() . '::buildDSRetrievalSQL()',
Method orderBy
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function orderBy($cols, $direction = 'ASC')
{
$orders = [];
$randoms = ['RAND()', 'RANDOM()'];
if (!is_array($cols)) {
Method pushDeprecateWarningToLog
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pushDeprecateWarningToLog($method, $alternative = null, array $opts = array())
{
$defaults = array(
'message-format' => __('The method `%s` is deprecated.'),
'alternative-format' => __('Please use `%s` instead.'),
Method findDefaultData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findDefaultData()
{
$section = (new SectionManager)->select()->section($this->get('section_id'))->execute()->next();
$schema = $section->fetchFields();
Method fetchAllAssociatedEntryCounts
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetchAllAssociatedEntryCounts($associated_sections = null)
{
if (is_null($this->get('section_id'))) {
return null;
}
Method cleanupDatabase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function cleanupDatabase()
{
// Grab any extensions sitting in the database
$rows = Symphony::Database()
->select(['name', 'status'])
Method generateAttributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateAttributes()
{
$result = null;
foreach ($this->attributes as $attribute => $value) {
$hasValue = $value !== null && (is_bool($value) || strlen($value) > 0);
Method registerDelegates
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function registerDelegates($name)
{
$obj = self::getInstance($name);
$id = self::fetchExtensionID($name);
Method createTable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createTable()
{
return Symphony::Database()
->create('tbl_entries_data_' . General::intval($this->get('id')))
->ifNotExists()
Method createTable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createTable()
{
return Symphony::Database()
->create('tbl_entries_data_' . General::intval($this->get('id')))
->ifNotExists()
Method displayPublishPanel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
{
$states = $this->getToggleStates();
$value = isset($data['value']) ? $data['value'] : null;
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($message, $code = -1, Exception $ex = null)
{
switch ($code) {
case JSON_ERROR_NONE:
$message = __('No errors.');
Method createFilter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createFilter(&$wrapper, $data)
{
$li = new XMLElement('li');
$li->setAttribute('class', $data['instance']);
$li->setAttribute('data-type', $data['type']);