werneckbh/qr-code

View on GitHub

Showing 91 of 100 total issues

Function evaluateSymbol has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function evaluateSymbol (int $width, array $frame)
    {
        $head = 0;
        $demerit = 0;
Severity: Minor
Found in src/QR_Code/Encoder/Mask.php - About 5 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 eat8 has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function eat8 () : int
    {
        $la = Specifications::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
        $ln = Specifications::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
Severity: Minor
Found in src/QR_Code/Util/Split.php - About 3 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

Specifications has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class Specifications
{
    public static $capacity = [
        [0, 0, 0, [0, 0, 0, 0]],
        [21, 26, 0, [7, 10, 13, 17]], // 1
Severity: Minor
Found in src/QR_Code/Config/Specifications.php - About 3 hrs to fix

    Input has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Input
    {
        public $items;
    
        private $version;
    Severity: Minor
    Found in src/QR_Code/Encoder/Input.php - About 3 hrs to fix

      Function calcN1N3 has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function calcN1N3 ($length)
          {
              $demerit = 0;
      
              for ($i = 0; $i < $length; $i++) {
      Severity: Minor
      Found in src/QR_Code/Encoder/Mask.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

      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

      Function init_rs has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function init_rs ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
          {
              foreach (self::$items as $rs) {
                  if ($rs->pad != $pad) continue;
                  if ($rs->nroots != $nroots) continue;
      Severity: Minor
      Found in src/QR_Code/Encoder/ErrorCorrection/Rs.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 debug has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function debug ($frame, $binary_mode = false)
          {
              if ($binary_mode) {
      
                  foreach ($frame as &$frameLine) {
      Severity: Major
      Found in src/QR_Code/Config/Specifications.php - About 2 hrs to fix

        Function next has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function next ()
            {
                do {
        
                    if ($this->bit == -1) {
        Severity: Minor
        Found in src/QR_Code/Util/FrameFiller.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

          Function eatAn has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function eatAn () : int
              {
                  $la = Specifications::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
                  $ln = Specifications::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
          
          Severity: Minor
          Found in src/QR_Code/Util/Split.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 evaluateSymbol has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function evaluateSymbol (int $width, array $frame)
              {
                  $head = 0;
                  $demerit = 0;
          
          Severity: Major
          Found in src/QR_Code/Encoder/Mask.php - About 2 hrs to fix

            Method encodeMask has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function encodeMask (Input $input, $mask)
                {
                    if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
                        throw new \Exception('wrong version');
                    }
            Severity: Major
            Found in src/QR_Code/QR_Code.php - About 2 hrs to fix

              Method vectEPS has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function vectEPS ($frame, int $pixelPerPoint = 4, int $outerFrame = 4, int $backColor = 0xFFFFFF, int $foreColor = 0x000000, bool $cmyk = false) : string
                  {
                      $h = count($frame);
                      $w = strlen($frame[0]);
              
              Severity: Major
              Found in src/QR_Code/Encoder/Vector.php - About 2 hrs to fix

                Method createFrame has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function createFrame ($version)
                    {
                        $width = self::$capacity[$version][QRCAP_WIDTH];
                        $frameLine = str_repeat("\0", $width);
                        $frame = array_fill(0, $width, $frameLine);
                Severity: Minor
                Found in src/QR_Code/Config/Specifications.php - About 1 hr to fix

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

                      public function splitString () : int
                      {
                          while (strlen($this->dataStr) > 0) {
                              if ($this->dataStr == '')
                                  return 0;
                  Severity: Minor
                  Found in src/QR_Code/Util/Split.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 makeMaskNo has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function makeMaskNo ($maskNo, $width, $s, &$d, $maskGenOnly = false)
                      {
                          $b = 0;
                          $bitMask = [];
                  
                  Severity: Minor
                  Found in src/QR_Code/Encoder/Mask.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 eat8 has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function eat8 () : int
                      {
                          $la = Specifications::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
                          $ln = Specifications::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
                  
                  Severity: Minor
                  Found in src/QR_Code/Util/Split.php - About 1 hr to fix

                    Function encodeMask has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function encodeMask (Input $input, $mask)
                        {
                            if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
                                throw new \Exception('wrong version');
                            }
                    Severity: Minor
                    Found in src/QR_Code/QR_Code.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 writeFormatInformation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function writeFormatInformation (int $width, array &$frame, int $mask, int $level) : int
                        {
                            $blacks = 0;
                            $format = Specifications::getFormatInfo($mask, $level);
                    
                    Severity: Minor
                    Found in src/QR_Code/Encoder/Mask.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

                    Severity
                    Category
                    Status
                    Source
                    Language