symphonycms/symphony-2

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

Summary

Maintainability
D
2 days
Test Coverage

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

    public static function fetch($id = null, $section_id = null, $order = 'ASC', $sortfield = 'sortorder', $type = null, $location = null, $where = null, $restrict = Field::__FIELD_ALL__)
    {
        if (Symphony::Log()) {
            Symphony::Log()->pushDeprecateWarningToLog('FieldManager::fetch()', 'FieldManager::select()');
        }
Severity: Minor
Found in symphony/lib/toolkit/class.fieldmanager.php - About 4 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.fieldmanager.php has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

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

    FieldManager has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FieldManager implements FileResource
    {
        /**
         * An array of all the objects that the Manager is responsible for.
         * Defaults to an empty array.
    Severity: Minor
    Found in symphony/lib/toolkit/class.fieldmanager.php - About 2 hrs to fix

      Method fetch has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function fetch($id = null, $section_id = null, $order = 'ASC', $sortfield = 'sortorder', $type = null, $location = null, $where = null, $restrict = Field::__FIELD_ALL__)
          {
              if (Symphony::Log()) {
                  Symphony::Log()->pushDeprecateWarningToLog('FieldManager::fetch()', 'FieldManager::select()');
              }
      Severity: Major
      Found in symphony/lib/toolkit/class.fieldmanager.php - About 2 hrs to fix

        Function fetchFieldIDFromElementName has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function fetchFieldIDFromElementName($element_name, $section_id = null)
            {
                $schema_sql = Symphony::Database()
                    ->select(['id'])
                    ->from('tbl_fields')
        Severity: Minor
        Found in symphony/lib/toolkit/class.fieldmanager.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

        Function __getClassPath has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function __getClassPath($type)
            {
                if (is_file(TOOLKIT . "/fields/field.{$type}.php")) {
                    return TOOLKIT . '/fields';
                } else {
        Severity: Minor
        Found in symphony/lib/toolkit/class.fieldmanager.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 listAll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function listAll()
            {
                $structure = General::listStructure(TOOLKIT . '/fields', '/field.[a-z0-9_-]+.php/i', false, 'asc', TOOLKIT . '/fields');
                $extensions = Symphony::ExtensionManager()->listInstalledHandles();
                $types = array();
        Severity: Minor
        Found in symphony/lib/toolkit/class.fieldmanager.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 fetchFieldIDFromElementName has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function fetchFieldIDFromElementName($element_name, $section_id = null)
            {
                $schema_sql = Symphony::Database()
                    ->select(['id'])
                    ->from('tbl_fields')
        Severity: Minor
        Found in symphony/lib/toolkit/class.fieldmanager.php - About 1 hr to fix

          Method isTextFormatterUsed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function isTextFormatterUsed($text_formatter_handle)
              {
                  $fields = Symphony::Database()
                      ->select(['type'])
                      ->distinct()
          Severity: Minor
          Found in symphony/lib/toolkit/class.fieldmanager.php - About 1 hr to fix

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

                public static function fetch($id = null, $section_id = null, $order = 'ASC', $sortfield = 'sortorder', $type = null, $location = null, $where = null, $restrict = Field::__FIELD_ALL__)
            Severity: Major
            Found in symphony/lib/toolkit/class.fieldmanager.php - About 1 hr to fix

              Function isTextFormatterUsed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function isTextFormatterUsed($text_formatter_handle)
                  {
                      $fields = Symphony::Database()
                          ->select(['type'])
                          ->distinct()
              Severity: Minor
              Found in symphony/lib/toolkit/class.fieldmanager.php - About 55 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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function create($type)
                  {
                      if (!isset(self::$_pool[$type])) {
                          $classname = self::__getClassName($type);
                          $path = self::__getDriverPath($type);
              Severity: Minor
              Found in symphony/lib/toolkit/class.fieldmanager.php - About 45 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