MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Function updateWorkers has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  public function updateWorkers($account_id, $data) {
    $this->debug->append("STA " . __METHOD__, 4);
    if (!is_array($data)) {
      $this->setErrorMessage('No workers to update');
      return false;
Severity: Minor
Found in include/classes/worker.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

Function setHeaders has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function setHeaders(Swift_Mime_HeaderSet $headers)
    {
        $this->_headerCanonData = '';
        // Loop through Headers
        $listHeaders = $headers->listAll();
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.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

Function setHeaders has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function setHeaders(Swift_Mime_HeaderSet $headers)
    {
        $this->_startHash();
        $this->_canonData = '';
        // Loop through Headers
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Signers/DomainKeySigner.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 smarty_modifier_relative_date has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function smarty_modifier_relative_date($timestamp, $days = false, $format = "M j, Y") {
  
  if (!is_numeric($timestamp)) {
    // It's not a time stamp, so try to convert it...
    $timestamp = strtotime($timestamp);
Severity: Minor
Found in include/smarty/libs/plugins/modifier.relative_date.php - About 1 hr to fix

    Method smarty_function_html_radios_output has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
    {
        $_output = '';
    
        if (is_object($value)) {
    Severity: Minor
    Found in include/smarty/libs/plugins/function.html_radios.php - About 1 hr to fix

      Method smarty_function_cycle has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function smarty_function_cycle($params, $template)
      {
          static $cycle_vars;
      
          $name = (empty($params['name'])) ? 'default' : $params['name'];
      Severity: Minor
      Found in include/smarty/libs/plugins/function.cycle.php - About 1 hr to fix

        Method compile has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function compile($args, $compiler, $parameter)
            {
                // the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
                $this->required_attributes = array('var', 'value');
                $this->shorttag_order = array('var', 'value');
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_compile_assign.php - About 1 hr to fix

          Method yylex4 has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function yylex4()
              {
                  $tokenMap = array (
                        1 => 0,
                        2 => 0,
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 1 hr to fix

            Method _canonicalizeBody has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _canonicalizeBody($string)
                {
                    $len = strlen($string);
                    $canon = '';
                    $method = ($this->_bodyCanon == "relaxed");
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.php - About 1 hr to fix

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

                                              if (!is_array($function)) {
                                                  $output = "{$function}({$params})";
                                              } else {
                                                  if (is_object($function[0])) {
                                                      $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
              include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php on lines 51..59

              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 118.

              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

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

                                          if (!is_array($function)) {
                                              $output = "{$function}({$params})";
                                          } else {
                                              if (is_object($function[0])) {
                                                  $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
              include/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php on lines 112..120

              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 118.

              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

              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 createTemplate has 46 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 (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
                            $parent = $cache_id;
                            $cache_id = null;
                Severity: Minor
                Found in include/smarty/libs/Smarty.class.php - About 1 hr to fix

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

                      public function append($tpl_var, $value = null, $merge = false, $nocache = false)
                      {
                          if (is_array($tpl_var)) {
                              // $tpl_var is an array, ignore $value
                              foreach ($tpl_var as $_key => $_val) {
                  Severity: Minor
                  Found in include/smarty/libs/sysplugins/smarty_internal_data.php - About 1 hr to fix

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

                        public function yylex6()
                        {
                            $tokenMap = array (
                                  1 => 0,
                                  2 => 0,
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 1 hr to fix

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

                        public function getTransactionTypebyTime($account_id=NULL) {
                          $this->debug->append("STA " . __METHOD__, 4);
                          if ($data = $this->memcache->get(__FUNCTION__)) return $data;
                          $stmt = $this->mysqli->prepare("
                            SELECT
                      Severity: Minor
                      Found in include/classes/transaction.class.php - About 1 hr to fix

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

                            public function yylex5()
                            {
                                $tokenMap = array (
                                      1 => 0,
                                      2 => 0,
                        Severity: Minor
                        Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 1 hr to fix

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

                              public function compile($args, $compiler)
                              {
                                  if (!($compiler->smarty instanceof SmartyBC)) {
                                      throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable");
                                  }

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

                                public function setChildren(array $children, $compoundLevel = null)
                                {
                                    // TODO: Try to refactor this logic
                            
                                    $compoundLevel = isset($compoundLevel)
                            Severity: Minor
                            Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 1 hr to fix

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

                                  protected function parseSpan($str) {
                                  #
                                  # Take the string $str and parse it into tokens, hashing embeded HTML,
                                  # escaped characters and handling code spans.
                                  #
                              Severity: Minor
                              Found in include/lib/Michelf/Markdown.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language