MPOS/php-mpos

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

Summary

Maintainability
F
2 wks
Test Coverage

Function testInstall has a Cognitive Complexity of 250 (exceeds 5 allowed). Consider refactoring.
Open

    public static function testInstall(Smarty $smarty, &$errors=null)
    {
        $status = true;

        if ($errors === null) {
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 5 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 testInstall has 480 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function testInstall(Smarty $smarty, &$errors=null)
    {
        $status = true;

        if ($errors === null) {
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 2 days to fix

    File smarty_internal_utility.php has 668 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Project:     Smarty: the PHP compiling template engine
     * File:        smarty_internal_utility.php
     * SVN:         $Id: $
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 day to fix

      Function clearCompiledTemplate has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
          {
              $_compile_dir = $smarty->getCompileDir();
              $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
              $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 6 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 compileAllConfig has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
          {
              // switch off time limit
              if (function_exists('set_time_limit')) {
                  @set_time_limit($time_limit);
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 4 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 compileAllTemplates has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
          {
              // switch off time limit
              if (function_exists('set_time_limit')) {
                  @set_time_limit($time_limit);
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 4 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 clearCompiledTemplate has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
          {
              $_compile_dir = $smarty->getCompileDir();
              $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
              $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 2 hrs to fix

        Method compileAllTemplates has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
            {
                // switch off time limit
                if (function_exists('set_time_limit')) {
                    @set_time_limit($time_limit);
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 hr to fix

          Method compileAllConfig has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
              {
                  // switch off time limit
                  if (function_exists('set_time_limit')) {
                      @set_time_limit($time_limit);
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                            if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
                                && (!isset($resource_name)
                                    || (isset($_filepath[$_resource_part_1_length])
                                        && substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)
                                    || (isset($_filepath[$_resource_part_2_length])
            Severity: Critical
            Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 hr to fix

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

                  public static function compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 35 mins to fix

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

                    public static function compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 35 mins to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          foreach ($smarty->getTemplateDir() as $template_dir) {
                              $_template_dir = $template_dir;
                              $template_dir = realpath($template_dir);
                              // resolve include_path or fail existence
                              if (!$template_dir) {
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
                  include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 557..621

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 399.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          foreach ($smarty->getConfigDir() as $config_dir) {
                              $_config_dir = $config_dir;
                              $config_dir = realpath($config_dir);
                              // resolve include_path or fail existence
                              if (!$config_dir) {
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
                  include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 308..372

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 399.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if (!$_compile_dir) {
                              $status = false;
                              $message = "FAILED: {$__compile_dir} does not exist";
                              if ($errors === null) {
                                  echo $message . ".\n";
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
                  include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 514..550

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 283.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if (!$_cache_dir) {
                              $status = false;
                              $message = "FAILED: {$__cache_dir} does not exist";
                              if ($errors === null) {
                                  echo $message . ".\n";
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
                  include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 381..417

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 283.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if ($expected) {
                                  $status = false;
                                  $message = "FAILED: files missing from libs/sysplugins: ". join(', ', array_keys($expected));
                                  if ($errors === null) {
                                      echo $message . ".\n";
                  Severity: Minor
                  Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 30 mins to fix
                  include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 794..804

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 90.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if ($expected) {
                                  $status = false;
                                  $message = "FAILED: files missing from libs/plugins: ". join(', ', array_keys($expected));
                                  if ($errors === null) {
                                      echo $message . ".\n";
                  Severity: Minor
                  Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 30 mins to fix
                  include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 709..719

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 90.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status