werneckbh/qr-code

View on GitHub
src/QR_Code/Encoder/ErrorCorrection/RsItem.php

Summary

Maintainability
C
1 day
Test Coverage

Function init_rs_char has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public static function init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
    {
        // Common code for intializing a Reed-Solomon control block (char or int symbols)
        // Copyright 2004 Phil Karn, KA9Q
        // May be used under the terms of the GNU Lesser General Public License (LGPL)
Severity: Minor
Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 2 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 init_rs_char has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
    {
        // Common code for intializing a Reed-Solomon control block (char or int symbols)
        // Copyright 2004 Phil Karn, KA9Q
        // May be used under the terms of the GNU Lesser General Public License (LGPL)
Severity: Major
Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 2 hrs to fix

    Method encode_rs_char has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function encode_rs_char ($data, &$parity)
        {
            $MM =& $this->mm;
            $NN =& $this->nn;
            $ALPHA_TO =& $this->alpha_to;
    Severity: Minor
    Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 1 hr to fix

      Function encode_rs_char has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function encode_rs_char ($data, &$parity)
          {
              $MM =& $this->mm;
              $NN =& $this->nn;
              $ALPHA_TO =& $this->alpha_to;
      Severity: Minor
      Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 55 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

      Method init_rs_char has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
      Severity: Minor
      Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 45 mins to fix

        Avoid too many return statements within this method.
        Open

                return $rs;
        Severity: Major
        Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return $rs;
          Severity: Major
          Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    if ($pad < 0 || $pad >= ((1 << $symsize) - 1 - $nroots)) return $rs; // Too much padding
            Severity: Major
            Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status