modxcms/revolution

View on GitHub
core/model/smarty/sysplugins/smarty_internal_template.php

Summary

Maintainability
F
5 days
Test Coverage

Function _subTemplateRender has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    public function _subTemplateRender(
        $template,
        $cache_id,
        $compile_id,
        $caching,
Severity: Minor
Found in core/model/smarty/sysplugins/smarty_internal_template.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

File smarty_internal_template.php has 429 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Smarty Internal Plugin Template
 * This file contains the Smarty template engine
 *
Severity: Minor
Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 6 hrs to fix

    Function render has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render($no_output_filter = true, $display = null)
        {
            if ($this->smarty->debugging) {
                if (!isset($this->smarty->_debug)) {
                    $this->smarty->_debug = new Smarty_Internal_Debug();
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 5 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

    Function _decodeProperties has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
        {
            // on cache resources other than file check version stored in cache code
            if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
                if ($cache) {
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 5 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 _subTemplateRender has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _subTemplateRender(
            $template,
            $cache_id,
            $compile_id,
            $caching,
    Severity: Major
    Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 3 hrs to fix

      Function _checkPlugins has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _checkPlugins($plugins)
          {
              static $checked = array();
              foreach ($plugins as $plugin) {
                  $name = join('::', (array)$plugin[ 'function' ]);
      Severity: Minor
      Found in core/model/smarty/sysplugins/smarty_internal_template.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

      Method render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render($no_output_filter = true, $display = null)
          {
              if ($this->smarty->debugging) {
                  if (!isset($this->smarty->_debug)) {
                      $this->smarty->_debug = new Smarty_Internal_Debug();
      Severity: Major
      Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 2 hrs to fix

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

        class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
        {
            /**
             * Template object cache
             *
        Severity: Minor
        Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 2 hrs to fix

          Method _decodeProperties has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
              {
                  // on cache resources other than file check version stored in cache code
                  if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
                      if ($cache) {
          Severity: Major
          Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 2 hrs to fix

            Method _subTemplateRender has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $template,
                    $cache_id,
                    $compile_id,
                    $caching,
                    $cache_lifetime,
            Severity: Major
            Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 1 hr to fix

              Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $template_resource,
                      Smarty $smarty,
                      Smarty_Internal_Data $_parent = null,
                      $_cache_id = null,
                      $_compile_id = null,
              Severity: Major
              Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 1 hr to fix

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

                    public function _assignInScope($varName, $value, $nocache = false, $scope = 0)
                    {
                        if (isset($this->tpl_vars[ $varName ])) {
                            $this->tpl_vars[ $varName ] = clone $this->tpl_vars[ $varName ];
                            $this->tpl_vars[ $varName ]->value = $value;
                Severity: Minor
                Found in core/model/smarty/sysplugins/smarty_internal_template.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

                Consider simplifying this complex logical expression.
                Open

                            if (!$no_output_filter
                                && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
                                && (isset($this->smarty->autoload_filters[ 'output' ])
                                    || isset($this->smarty->registered_filters[ 'output' ]))
                            ) {
                Severity: Major
                Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                  if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
                                      && !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ])
                                                                || isset($this->smarty->registered_filters[ 'output' ]))
                                  ) {
                                      echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
                  Severity: Major
                  Found in core/model/smarty/sysplugins/smarty_internal_template.php - About 40 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status