TeaThemeOptions/TeaThemeOptions

View on GitHub
src/Core/PostType/PosttypeHook.php

Summary

Maintainability
D
2 days
Test Coverage

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

<?php

namespace crewstyle\OlympusZeus\Core\Posttype;

use crewstyle\OlympusZeus\OlympusZeus;
Severity: Minor
Found in src/Core/PostType/PosttypeHook.php - About 4 hrs to fix

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

        public function hookPermalinkMake($permalink, $post_id, $leavename)
        {
            if (!$post_id) {
                return '';
            }
    Severity: Major
    Found in src/Core/PostType/PosttypeHook.php - About 2 hrs to fix

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

          public function hookFieldsDisplay()
          {
              //Defintions
              $slug = isset($_GET['post_type']) ? $_GET['post_type'] : '';
              $contents = array();
      Severity: Minor
      Found in src/Core/PostType/PosttypeHook.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 defineLabels has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function defineLabels($ctn)
          {
              return array(
                  'name' => $ctn['name'],
                  'singular_name' => isset($ctn['singular_name']) && !empty($ctn['singular_name']) 
      Severity: Minor
      Found in src/Core/PostType/PosttypeHook.php - About 1 hr to fix

        Method hookFieldsDisplay has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function hookFieldsDisplay()
            {
                //Defintions
                $slug = isset($_GET['post_type']) ? $_GET['post_type'] : '';
                $contents = array();
        Severity: Minor
        Found in src/Core/PostType/PosttypeHook.php - About 1 hr to fix

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

              public function hookFieldsPermalink()
              {
                  if (empty($this->posttypes)) {
                      return false;
                  }
          Severity: Minor
          Found in src/Core/PostType/PosttypeHook.php - About 1 hr to fix

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

                public function hookPermalinkMake($permalink, $post_id, $leavename)
                {
                    if (!$post_id) {
                        return '';
                    }
            Severity: Minor
            Found in src/Core/PostType/PosttypeHook.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 setPostTypes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function setPostTypes($pts)
                {
                    //Define post types
                    $this->posttypes = $pts;
            
            
            Severity: Minor
            Found in src/Core/PostType/PosttypeHook.php - About 1 hr to fix

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

                  public function hookFieldsPermalink()
                  {
                      if (empty($this->posttypes)) {
                          return false;
                      }
              Severity: Minor
              Found in src/Core/PostType/PosttypeHook.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

              Avoid too many return statements within this method.
              Open

                      return array($posttype, $slug);
              Severity: Major
              Found in src/Core/PostType/PosttypeHook.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status