MPOS/php-mpos

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

Summary

Maintainability
C
1 day
Test Coverage

Function __construct has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(Smarty_Internal_Template $_template)
    {
        $this->compile_id = $_template->compile_id;
        $this->cache_id = $_template->cache_id;
        $this->source = $_template->source;
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_cacheresource.php - About 7 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 __construct has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(Smarty_Internal_Template $_template)
    {
        $this->compile_id = $_template->compile_id;
        $this->cache_id = $_template->cache_id;
        $this->source = $_template->source;
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_cacheresource.php - About 2 hrs to fix

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

        public static function load(Smarty $smarty, $type = null)
        {
            if (!isset($type)) {
                $type = $smarty->caching_type;
            }
    Severity: Minor
    Found in include/smarty/libs/sysplugins/smarty_cacheresource.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

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

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

          public function write(Smarty_Internal_Template $_template, $content)
          {
              if (!$_template->source->recompiled) {
                  if ($this->handler->writeCachedContent($_template, $content)) {
                      $this->timestamp = time();
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_cacheresource.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