modxcms/revolution

View on GitHub
core/model/smarty/Smarty.class.php

Summary

Maintainability
F
3 days
Test Coverage

File Smarty.class.php has 558 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Project:     Smarty: the PHP compiling template engine
 * File:        Smarty.class.php
 *
Severity: Major
Found in core/model/smarty/Smarty.class.php - About 1 day to fix

    Smarty has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Smarty extends Smarty_Internal_TemplateBase
    {
        /**
         * smarty version
         */
    Severity: Minor
    Found in core/model/smarty/Smarty.class.php - About 6 hrs to fix

      Function createTemplate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
          {
              if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
                  $parent = $cache_id;
                  $cache_id = null;
      Severity: Minor
      Found in core/model/smarty/Smarty.class.php - About 2 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 createTemplate has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
          {
              if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
                  $parent = $cache_id;
                  $cache_id = null;
      Severity: Minor
      Found in core/model/smarty/Smarty.class.php - About 1 hr to fix

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

            public function addTemplateDir($template_dir, $key = null, $isConfig = false)
            {
                if ($isConfig) {
                    $processed = &$this->_processedConfigDir;
                    $dir = &$this->config_dir;
        Severity: Minor
        Found in core/model/smarty/Smarty.class.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 addTemplateDir has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addTemplateDir($template_dir, $key = null, $isConfig = false)
            {
                if ($isConfig) {
                    $processed = &$this->_processedConfigDir;
                    $dir = &$this->config_dir;
        Severity: Minor
        Found in core/model/smarty/Smarty.class.php - About 1 hr to fix

          Method _realpath has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _realpath($path, $realpath = null)
              {
                  $nds = array('/' => '\\', '\\' => '/');
                  preg_match(
                      '%^(?<root>(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
          Severity: Minor
          Found in core/model/smarty/Smarty.class.php - About 1 hr to fix

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

                    $template_name,
                    $cache_id = null,
                    $compile_id = null,
                    $caching = null,
                    Smarty_Internal_Template $template = null
            Severity: Minor
            Found in core/model/smarty/Smarty.class.php - About 35 mins to fix

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

                  public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
              Severity: Minor
              Found in core/model/smarty/Smarty.class.php - About 35 mins to fix

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

                    public function getPluginsDir()
                    {
                        if (empty($this->plugins_dir)) {
                            $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
                            $this->_pluginsDirNormalized = false;
                Severity: Minor
                Found in core/model/smarty/Smarty.class.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

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

                    private function _normalizeTemplateConfig($isConfig)
                    {
                        if ($isConfig) {
                            $processed = &$this->_processedConfigDir;
                            $dir = &$this->config_dir;
                Severity: Minor
                Found in core/model/smarty/Smarty.class.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