MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Avoid too many return statements within this method.
Open

                return "$time - NOTICE -->";
Severity: Major
Found in include/lib/KLogger.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return "$time - DEBUG -->";
    Severity: Major
    Found in include/lib/KLogger.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return "$time - LOG -->";
      Severity: Major
      Found in include/lib/KLogger.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return "$time - INFO -->";
        Severity: Major
        Found in include/lib/KLogger.php - About 30 mins to fix

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

              if (isset($params['time']) && is_array($params['time'])) {
                  if (isset($params['time'][$prefix . 'Hour'])) {
                      // $_REQUEST[$field_array] given
                      foreach (array('H' => 'Hour',  'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
                          $_variableName = '_' . strtolower($_elementName);
          Severity: Minor
          Found in include/smarty/libs/plugins/function.html_select_time.php and 1 other location - About 30 mins to fix
          include/smarty/libs/plugins/function.html_select_date.php on lines 181..212

          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

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

          function smarty_modifier_seconds_to_words($seconds) {
            if ($seconds < 0) throw new Exception("Can't do negative numbers!");
            if ($seconds == 0) return "zero seconds";
            if ($seconds < 1) return "less than a second";
          
          
          Severity: Minor
          Found in include/smarty/libs/plugins/modifier.seconds_to_words.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 getStreamVariable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getStreamVariable($variable)
              {
                  $_result = '';
                  $fp = fopen($variable, 'r+');
                  if ($fp) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_data.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, $content)
              {
                  if (!$_template->source->recompiled) {
                      if ($this->handler->writeCachedContent($_template, $content)) {
                          $this->timestamp = time();
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_cacheresource.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 yy_find_reduce_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function yy_find_reduce_action($stateno, $iLookAhead)
              {
                  /* $stateno = $this->yystack[$this->yyidx]->stateno; */
          
                  if (!isset(self::$yy_reduce_ofst[$stateno])) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.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 yy_r3_7 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function yy_r3_7($yy_subpatterns)
              {
          
            if ($this->mbstring_overload) {
              $to = mb_strlen($this->data,'latin1');
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.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 yy_r119 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function yy_r119(){
              if (!$this->security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + -2]->minor, $this->compiler)) {
                  if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor])) {
                      $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor].'::'.$this->yystack[$this->yyidx + 0]->minor;
                  } else {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.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 getScope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function &getScope($scope)
              {
                  if ($scope == Smarty::SCOPE_PARENT && !empty($this->parent)) {
                      return $this->parent->tpl_vars;
                  } elseif ($scope == Smarty::SCOPE_ROOT && !empty($this->parent)) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_template.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 yy_r7 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function yy_r7(){
              if ($this->php_handling == Smarty::PHP_PASSTHRU) {
                  $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));
              } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
                  $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.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 get_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function get_key($template)
              {
                  static $_is_stringy = array('string' => true, 'eval' => true);
                  // calculate Uid if not already done
                  if ($template->source->uid == '') {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_debug.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 populateCompiledFilepath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
              {
                  $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
                  $_filepath = $compiled->source->uid;
                  // if use_sub_dirs, break file into directories
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_resource.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function call($_name, Smarty_Internal_Template $_template, $_params, $_hash, $_nocache)
              {
                  if ($_nocache) {
                      $_function = "smarty_template_function_{$_name}_nocache";
                  } else {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_function_call_handler.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 yy_find_reduce_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function yy_find_reduce_action($stateno, $iLookAhead)
              {
                  /* $stateno = $this->yystack[$this->yyidx]->stateno; */
          
                  if (!isset(self::$yy_reduce_ofst[$stateno])) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
              {
                  if (!$cached) {
                      $cached = $_template->cached;
                  }
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.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 populate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
              {
                  $source->filepath = $this->buildFilepath($source, $_template);
          
                  if ($source->filepath !== false) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_resource_file.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

          Severity
          Category
          Status
          Source
          Language