symphonycms/symphony-2

View on GitHub
symphony/lib/toolkit/class.entrymanager.php

Summary

Maintainability
F
3 days
Test Coverage

Function delete has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public static function delete($entries, $section_id = null)
    {
        $needs_data = true;

        if (!is_array($entries)) {
Severity: Minor
Found in symphony/lib/toolkit/class.entrymanager.php - About 5 hrs 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

File class.entrymanager.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * @package toolkit
 */
Severity: Minor
Found in symphony/lib/toolkit/class.entrymanager.php - About 4 hrs to fix

    Method delete has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function delete($entries, $section_id = null)
        {
            $needs_data = true;
    
            if (!is_array($entries)) {
    Severity: Major
    Found in symphony/lib/toolkit/class.entrymanager.php - About 2 hrs to fix

      Function fetch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null, $enable_sort = true)
          {
              if (Symphony::Log()) {
                  Symphony::Log()->pushDeprecateWarningToLog('EntryManager::fetch()', 'EntryManager::select()');
              }
      Severity: Minor
      Found in symphony/lib/toolkit/class.entrymanager.php - About 2 hrs 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 fetch has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null, $enable_sort = true)
          {
              if (Symphony::Log()) {
                  Symphony::Log()->pushDeprecateWarningToLog('EntryManager::fetch()', 'EntryManager::select()');
              }
      Severity: Major
      Found in symphony/lib/toolkit/class.entrymanager.php - About 2 hrs to fix

        Function saveFieldData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            protected static function saveFieldData($entry_id, $field_id, $field)
            {
                // Check that we have a field id
                if (empty($field_id)) {
                    return;
        Severity: Minor
        Found in symphony/lib/toolkit/class.entrymanager.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 fetchByPage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function fetchByPage($page = 1, $section_id, $entriesPerPage, $where = null, $joins = null, $group = false, $records_only = false, $buildentries = true, array $element_names = null)
            {
                if (Symphony::Log()) {
                    Symphony::Log()->pushDeprecateWarningToLog(
                        'EntryManager::fetchByPage()',
        Severity: Minor
        Found in symphony/lib/toolkit/class.entrymanager.php - About 1 hr to fix

          Method saveFieldData has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function saveFieldData($entry_id, $field_id, $field)
              {
                  // Check that we have a field id
                  if (empty($field_id)) {
                      return;
          Severity: Minor
          Found in symphony/lib/toolkit/class.entrymanager.php - About 1 hr to fix

            Method fetch has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null, $enable_sort = true)
            Severity: Major
            Found in symphony/lib/toolkit/class.entrymanager.php - About 1 hr to fix

              Method fetchByPage has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function fetchByPage($page = 1, $section_id, $entriesPerPage, $where = null, $joins = null, $group = false, $records_only = false, $buildentries = true, array $element_names = null)
              Severity: Major
              Found in symphony/lib/toolkit/class.entrymanager.php - About 1 hr to fix

                Function fetchByPage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function fetchByPage($page = 1, $section_id, $entriesPerPage, $where = null, $joins = null, $group = false, $records_only = false, $buildentries = true, array $element_names = null)
                    {
                        if (Symphony::Log()) {
                            Symphony::Log()->pushDeprecateWarningToLog(
                                'EntryManager::fetchByPage()',
                Severity: Minor
                Found in symphony/lib/toolkit/class.entrymanager.php - About 35 mins 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 fetchCount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function fetchCount($section_id = null, $where = null, $joins = null, $group = false)
                    {
                        if (Symphony::Log()) {
                            Symphony::Log()->pushDeprecateWarningToLog('EntryManager::fetchCount()', 'EntryManager::select()->count()');
                        }
                Severity: Minor
                Found in symphony/lib/toolkit/class.entrymanager.php - About 25 mins 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

                There are no issues that match your filters.

                Category
                Status