symphonycms/symphony-2

View on GitHub

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'],
        ]);
Severity: Minor
Found in symphony/lib/toolkit/class.entryqueryauthoradapter.php - About 1 hr to fix

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) {
Severity: Minor
Found in symphony/content/content.publish.php - About 1 hr to fix

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();
Severity: Minor
Found in symphony/content/content.ajaxfilters.php - About 1 hr to fix

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');
Severity: Minor
Found in symphony/lib/toolkit/class.field.php - About 1 hr to fix

    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');
    Severity: Minor
    Found in symphony/lib/toolkit/class.xsrf.php - About 1 hr to fix

      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);
      
      
      Severity: Minor
      Found in symphony/lib/toolkit/class.general.php - About 1 hr to fix

        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()',
        Severity: Minor
        Found in symphony/lib/toolkit/fields/field.date.php - About 1 hr to fix

          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()',
          Severity: Minor
          Found in symphony/lib/toolkit/fields/field.textarea.php - About 1 hr to fix

            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)) {
            Severity: Minor
            Found in symphony/lib/toolkit/class.databasequery.php - About 1 hr to fix

              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.'),
              Severity: Minor
              Found in symphony/lib/core/class.log.php - About 1 hr to fix

                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();
                
                
                Severity: Minor
                Found in symphony/lib/toolkit/class.entry.php - About 1 hr to fix

                  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;
                          }
                  Severity: Minor
                  Found in symphony/lib/toolkit/class.entry.php - About 1 hr to fix

                    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'])
                    Severity: Minor
                    Found in symphony/lib/toolkit/class.extensionmanager.php - About 1 hr to fix

                      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);
                      Severity: Minor
                      Found in symphony/lib/toolkit/class.xmlelement.php - About 1 hr to fix

                        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);
                        
                        
                        Severity: Minor
                        Found in symphony/lib/toolkit/class.extensionmanager.php - About 1 hr to fix

                          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()
                          Severity: Minor
                          Found in symphony/lib/toolkit/fields/field.taglist.php - About 1 hr to fix

                            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()
                            Severity: Minor
                            Found in symphony/lib/toolkit/fields/field.input.php - About 1 hr to fix

                              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;
                              
                              
                              Severity: Minor
                              Found in symphony/lib/toolkit/fields/field.select.php - About 1 hr to fix

                                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.');
                                Severity: Minor
                                Found in symphony/lib/toolkit/class.jsonexception.php - About 1 hr to fix

                                  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']);
                                  Severity: Minor
                                  Found in symphony/content/content.publish.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language