MPOS/php-mpos

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

Summary

Maintainability
F
1 wk
Test Coverage

Function fetch has a Cognitive Complexity of 197 (exceeds 5 allowed). Consider refactoring.
Open

    public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
    {
        if ($template === null && $this instanceof $this->template_class) {
            $template = $this;
        }
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 4 days 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 fetch has 282 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
    {
        if ($template === null && $this instanceof $this->template_class) {
            $template = $this;
        }
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 1 day to fix

    File smarty_internal_templatebase.php has 522 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Smarty Internal Plugin Smarty Template  Base
     *
     * This file contains the basic shared methodes for template handling
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 1 day to fix

      Function __call has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __call($name, $args)
          {
              static $_prefixes = array('set' => true, 'get' => true);
              static $_resolved_property_name = array();
              static $_resolved_property_source = array();
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 3 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

      Smarty_Internal_TemplateBase has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
      {
          /**
           * fetches a rendered Smarty template
           *
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 2 hrs to fix

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

            public function __call($name, $args)
            {
                static $_prefixes = array('set' => true, 'get' => true);
                static $_resolved_property_name = array();
                static $_resolved_property_source = array();
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 1 hr to fix

          Function registerObject has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
              {
                  // test if allowed methodes callable
                  if (!empty($allowed)) {
                      foreach ((array) $allowed as $method) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.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 fetch has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
          Severity: Major
          Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 50 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if ((!$this->caching || $_template->has_nocache_code || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {
                        $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template);
                    }
            Severity: Major
            Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 40 mins to fix

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

                  public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 35 mins to fix

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

                    public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return false;
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $this->smarty->$property_name = $args[0];
                    Severity: Major
                    Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 30 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status