plugins/site_map/modules/yf_site_map.class.php

Summary

Maintainability
F
3 days
Test Coverage

Function _generate_sitemap has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    public function _generate_sitemap()
    {
        main()->NO_GRAPHICS = true;
        if ( ! $this->SITE_MAP_ENABLED) {
            return false;
Severity: Minor
Found in plugins/site_map/modules/yf_site_map.class.php - About 1 day 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 yf_site_map.class.php has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Site Map Generator (implementation of the http://www.sitemaps.org/protocol.php).
 *
Severity: Minor
Found in plugins/site_map/modules/yf_site_map.class.php - About 5 hrs to fix

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

        public function _store_item($data = [])
        {
            if (is_string($data) && strlen($data)) {
                $data = ['url' => $data];
            }
    Severity: Minor
    Found in plugins/site_map/modules/yf_site_map.class.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

    Method _generate_sitemap has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _generate_sitemap()
        {
            main()->NO_GRAPHICS = true;
            if ( ! $this->SITE_MAP_ENABLED) {
                return false;
    Severity: Major
    Found in plugins/site_map/modules/yf_site_map.class.php - About 4 hrs to fix

      Method _store_item has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _store_item($data = [])
          {
              if (is_string($data) && strlen($data)) {
                  $data = ['url' => $data];
              }
      Severity: Major
      Found in plugins/site_map/modules/yf_site_map.class.php - About 2 hrs to fix

        Function _get_modules_from_files has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _get_modules_from_files()
            {
                $regex = '~function(\s)+(' . implode('|', $this->HOOK_NAMES) . ')\s*\(~ims';
        
                $yf_prefix_len = strlen(YF_PREFIX);
        Severity: Minor
        Found in plugins/site_map/modules/yf_site_map.class.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 _get_modules_from_files has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _get_modules_from_files()
            {
                $regex = '~function(\s)+(' . implode('|', $this->HOOK_NAMES) . ')\s*\(~ims';
        
                $yf_prefix_len = strlen(YF_PREFIX);
        Severity: Minor
        Found in plugins/site_map/modules/yf_site_map.class.php - About 1 hr to fix

          Method _init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _init()
              {
                  if ($this->USE_LOCKING) {
                      $this->LOCK_FILE_NAME = STORAGE_PATH . $this->LOCK_FILE_NAME;
                  }
          Severity: Minor
          Found in plugins/site_map/modules/yf_site_map.class.php - About 1 hr to fix

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

                public function _init()
                {
                    if ($this->USE_LOCKING) {
                        $this->LOCK_FILE_NAME = STORAGE_PATH . $this->LOCK_FILE_NAME;
                    }
            Severity: Minor
            Found in plugins/site_map/modules/yf_site_map.class.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