MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

Avoid too many return statements within this method.
Open

                return "$time - ERROR -->";
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 - 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 - INFO -->";
        Severity: Major
        Found in include/lib/KLogger.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return "$time - WARN -->";
          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

              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 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 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 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_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 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 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 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_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 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 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 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

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

                public function addNews($account_id, $aData, $active=false) {
                  $this->debug->append("STA " . __METHOD__, 4);
                  if (empty($aData['header'])) return false;
                  if (empty($aData['content'])) return false;
                  if (!is_int($account_id)) return false;
              Severity: Minor
              Found in include/classes/news.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

              Severity
              Category
              Status
              Source
              Language