TeaThemeOptions/TeaThemeOptions

View on GitHub
src/Core/Term/TermHook.php

Summary

Maintainability
C
1 day
Test Coverage

Method defineLabels has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function defineLabels($ctn, $hierarchical = false)
    {
        $labels = array(
            'name' => $ctn['name'],
            'singular_name' => isset($ctn['singular_name']) && !empty($ctn['singular_name']) 
Severity: Major
Found in src/Core/Term/TermHook.php - About 2 hrs to fix

    Method setTerms has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setTerms($terms)
        {
            $this->terms = $terms;
    
            //Add WP Hooks
    Severity: Minor
    Found in src/Core/Term/TermHook.php - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if ($hierarchical) {
                  $labels['parent_item'] = isset($ctn['parent_item']) && !empty($ctn['parent_item']) 
                      ? $ctn['parent_item'] 
                      : OlympusZeus::translate('Parent item');
                  $labels['parent_item_colon'] = isset($ctn['parent_item_colon']) && !empty($ctn['parent_item_colon']) 
      Severity: Critical
      Found in src/Core/Term/TermHook.php - About 1 hr to fix

        Method hookFieldsSave has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function hookFieldsSave($term_id)
            {
                //Admin panel
                if (!OLZ_ISADMIN) {
                    return;
        Severity: Minor
        Found in src/Core/Term/TermHook.php - About 1 hr to fix

          Function hookFieldsSave has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function hookFieldsSave($term_id)
              {
                  //Admin panel
                  if (!OLZ_ISADMIN) {
                      return;
          Severity: Minor
          Found in src/Core/Term/TermHook.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 hookFieldsDisplay has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function hookFieldsDisplay($term)
              {
                  //Definitions
                  $contents = array();
                  $ids = array();
          Severity: Minor
          Found in src/Core/Term/TermHook.php - About 1 hr to fix

            Function hookFieldsDisplay has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function hookFieldsDisplay($term)
                {
                    //Definitions
                    $contents = array();
                    $ids = array();
            Severity: Minor
            Found in src/Core/Term/TermHook.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

            Avoid too many return statements within this method.
            Open

                        return;
            Severity: Major
            Found in src/Core/Term/TermHook.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return;
              Severity: Major
              Found in src/Core/Term/TermHook.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return;
                Severity: Major
                Found in src/Core/Term/TermHook.php - About 30 mins to fix

                  Function registerTerm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function registerTerm($term = array())
                      {
                          //Check post types
                          if (empty($term)) {
                              return array();
                  Severity: Minor
                  Found in src/Core/Term/TermHook.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