modxcms/revolution

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

Summary

Maintainability
C
7 hrs
Test Coverage

Method populateCompiledFilepath has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function populateCompiledFilepath(Smarty_Internal_Template $_template)
    {
        $source = &$_template->source;
        $smarty = &$_template->smarty;
        $this->filepath = $smarty->getCompileDir();
Severity: Minor
Found in core/model/smarty/sysplugins/smarty_template_compiled.php - About 1 hr to fix

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

        public function render(Smarty_Internal_Template $_template)
        {
            // checks if template exists
            if (!$_template->source->exists) {
                $type = $_template->source->isConfig ? 'config' : 'template';
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_template_compiled.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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render(Smarty_Internal_Template $_template)
        {
            // checks if template exists
            if (!$_template->source->exists) {
                $type = $_template->source->isConfig ? 'config' : 'template';
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_template_compiled.php - About 1 hr to fix

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

          public function process(Smarty_Internal_Template $_smarty_tpl)
          {
              $source = &$_smarty_tpl->source;
              $smarty = &$_smarty_tpl->smarty;
              if ($source->handler->recompiled) {
      Severity: Minor
      Found in core/model/smarty/sysplugins/smarty_template_compiled.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 process has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process(Smarty_Internal_Template $_smarty_tpl)
          {
              $source = &$_smarty_tpl->source;
              $smarty = &$_smarty_tpl->smarty;
              if ($source->handler->recompiled) {
      Severity: Minor
      Found in core/model/smarty/sysplugins/smarty_template_compiled.php - About 1 hr to fix

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

            public function populateCompiledFilepath(Smarty_Internal_Template $_template)
            {
                $source = &$_template->source;
                $smarty = &$_template->smarty;
                $this->filepath = $smarty->getCompileDir();
        Severity: Minor
        Found in core/model/smarty/sysplugins/smarty_template_compiled.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

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

            private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl)
            {
                if (function_exists('opcache_invalidate')
                    && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
                ) {
        Severity: Minor
        Found in core/model/smarty/sysplugins/smarty_template_compiled.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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function write(Smarty_Internal_Template $_template, $code)
            {
                if (!$_template->source->handler->recompiled) {
                    if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
                        $this->timestamp = $this->exists = is_file($this->filepath);
        Severity: Minor
        Found in core/model/smarty/sysplugins/smarty_template_compiled.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