MPOS/php-mpos

View on GitHub
include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php

Summary

Maintainability
D
2 days
Test Coverage

Function clear has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
Open

        public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
        {
            $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
            $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
            $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.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

Method clear has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
        {
            $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
            $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
            $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php - About 3 hrs to fix

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

            public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
            {
                $_source_file_path = str_replace(':', '.', $_template->source->filepath);
                $_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
                $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;

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

              public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
              {
                  $_source_file_path = str_replace(':', '.', $_template->source->filepath);
                  $_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
                  $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.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

      Method clear has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status