MPOS/php-mpos

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

Summary

Maintainability
C
1 day
Test Coverage

Smarty_CacheResource_KeyValueStore has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
{
    /**
     * cache for contents
     * @var array
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php - About 2 hrs to fix

    Function invalidate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
        {
            $now = microtime(true);
            $key = null;
            // invalidate everything

    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 listInvalidationKeys has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
        {
            $t = array('IVK#ALL');
            $_name = $_compile = '#';
            if ($resource_name) {

      Method fetch has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null, &$timestamp = null, $resource_uid = null)
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php - About 50 mins to fix

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

            protected function getTemplateUid(Smarty $smarty, $resource_name, $cache_id, $compile_id)
            {
                $uid = '';
                if (isset($resource_name)) {
                    $tpl = new $smarty->template_class($resource_name, $smarty);
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.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

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

            protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php - About 35 mins to fix

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

              protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php - About 35 mins to fix

            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_cacheresource_keyvaluestore.php - About 35 mins to fix

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

                  protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php - About 35 mins to fix

                Function listInvalidationKeys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
                    {
                        $t = array('IVK#ALL');
                        $_name = $_compile = '#';
                        if ($resource_name) {
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php - About 35 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

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

                    public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
                    {
                        if (!$cached) {
                            $cached = $_template->cached;
                        }
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.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