amtgard/ORK3

View on GitHub
system/lib/phpqrcode/bindings/tcpdf/qrcode.php

Summary

Maintainability
F
2 wks
Test Coverage

File qrcode.php has 1688 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
//============================================================+
// File name   : qrcode.php
// Begin       : 2010-03-22
// Last Update : 2010-03-29
Severity: Major
Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 4 days to fix

    QRcode has 98 functions (exceeds 20 allowed). Consider refactoring.
    Open

        class QRcode {
    
            /**
             * @var barcode array to be returned which is readable by TCPDF
             * @access protected
    Severity: Major
    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 day to fix

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

               protected function evaluateSymbol($width, $frame) {
                  $head = 0;
                  $demerit = 0;
                  for ($y=0; $y<$width; ++$y) {
                      $head = 0;
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 6 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 31 (exceeds 5 allowed). Consider refactoring.
      Open

               protected function eat8() {
                  $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
                  $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
                  $p = 1;
                  $dataStrLen = strlen($this->dataStr);
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 4 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 31 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
                  // Based on Reed solomon encoder by Phil Karn, KA9Q (GNU-LGPLv2)
                  $rs = null;
                  // Check parameter ranges
                  if (($symsize < 0) OR ($symsize > 8)) {
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 4 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 calcN1N3 has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

               protected function calcN1N3($length) {
                  $demerit = 0;
                  for ($i=0; $i<$length; ++$i) {
                      if ($this->runLength[$i] >= 5) {
                          $demerit += (N1 + ($this->runLength[$i] - 5));
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

      Function getNextPosition has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function getNextPosition() {
                  do {
                      if ($this->bit == -1) {
                          $this->bit = 0;
                          return array('x'=>$this->x, 'y'=>$this->y);
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

      Function createFrame has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function createFrame($version) {
                  $width = $this->capacity[$version][QRCAP_WIDTH];
                  $frameLine = str_repeat ("\0", $width);
                  $frame = array_fill(0, $width, $frameLine);
                  // Finder pattern
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

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

               protected function eatAn() {
                  $la = $this->lengthIndicator(QR_MODE_AN,  $this->version);
                  $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
                  $p = 0;
                  while($this->isalnumat($this->dataStr, $p)) {
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 splitString has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

               protected function splitString() {
                  while (strlen($this->dataStr) > 0) {
                      if ($this->dataStr == '') {
                          return 0;
                      }
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 encodeMask has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function encodeMask($mask) {
                  $spec = array(0, 0, 0, 0, 0);
                  $this->datacode = $this->getByteStream($this->items);
                  if (is_null($this->datacode)) {
                      return NULL;
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 writeFormatInformation has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

               protected function writeFormatInformation($width, &$frame, $mask, $level) {
                  $blacks = 0;
                  $format =  $this->getFormatInfo($mask, $level);
                  for ($i=0; $i<8; ++$i) {
                      if ($format & 1) {
      Severity: Minor
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
                  // Based on Reed solomon encoder by Phil Karn, KA9Q (GNU-LGPLv2)
                  $rs = null;
                  // Check parameter ranges
                  if (($symsize < 0) OR ($symsize > 8)) {
      Severity: Major
      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 2 hrs to fix

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

                 protected function lengthOfCode($mode, $version, $bits) {
                    $payload = $bits - 4 - $this->lengthIndicator($mode, $version);
                    switch($mode) {
                        case QR_MODE_NM: {
                            $chunks = (int)($payload / 10);
        Severity: Minor
        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                 protected function evaluateSymbol($width, $frame) {
                    $head = 0;
                    $demerit = 0;
                    for ($y=0; $y<$width; ++$y) {
                        $head = 0;
        Severity: Major
        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 2 hrs to fix

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

                  protected function createFrame($version) {
                      $width = $this->capacity[$version][QRCAP_WIDTH];
                      $frameLine = str_repeat ("\0", $width);
                      $frame = array_fill(0, $width, $frameLine);
                      // Finder pattern
          Severity: Minor
          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 2 hrs to fix

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

                    protected function encodeMask($mask) {
                        $spec = array(0, 0, 0, 0, 0);
                        $this->datacode = $this->getByteStream($this->items);
                        if (is_null($this->datacode)) {
                            return NULL;
            Severity: Minor
            Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 2 hrs to fix

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

                       protected function lengthOfCode($mode, $version, $bits) {
                          $payload = $bits - 4 - $this->lengthIndicator($mode, $version);
                          switch($mode) {
                              case QR_MODE_NM: {
                                  $chunks = (int)($payload / 10);
              Severity: Minor
              Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                Method init has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        protected function init($spec) {
                            $dl = $this->rsDataCodes1($spec);
                            $el = $this->rsEccCodes1($spec);
                            $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
                            $blockNo = 0;
                Severity: Minor
                Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                  Method getNextPosition has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          protected function getNextPosition() {
                              do {
                                  if ($this->bit == -1) {
                                      $this->bit = 0;
                                      return array('x'=>$this->x, 'y'=>$this->y);
                  Severity: Minor
                  Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

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

                             protected function identifyMode($pos) {
                                if ($pos >= strlen($this->dataStr)) {
                                    return QR_MODE_NL;
                                }
                                $c = $this->dataStr[$pos];
                    Severity: Minor
                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 putAlignmentPattern has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                             protected function putAlignmentPattern($version, $frame, $width) {
                                if ($version < 2) {
                                    return $frame;
                                }
                                $d = $this->alignmentPattern[$version][1] - $this->alignmentPattern[$version][0];
                    Severity: Minor
                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                             protected function eat8() {
                                $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
                                $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
                                $p = 1;
                                $dataStrLen = strlen($this->dataStr);
                    Severity: Minor
                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

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

                               protected function encode_rs_char($rs, $data, $parity) {
                                  $MM       =& $rs['mm']; // bits per symbol
                                  $NN       =& $rs['nn']; // the total number of symbols in a RS block
                                  $ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form
                                  $INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form
                      Severity: Minor
                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 convertData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                               protected function convertData($items) {
                                  $ver = $this->estimateVersion($items);
                                  if ($ver > $this->version) {
                                      $this->version = $ver;
                                  }
                      Severity: Minor
                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 __construct has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function __construct($code, $eclevel = 'L') {
                                  $barcode_array = array();
                                  if ((is_null($code)) OR ($code == '\0') OR ($code == '')) {
                                      return false;
                                  }
                      Severity: Minor
                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 encodeBitStream has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                               protected function encodeBitStream($inputitem, $version) {
                                  $inputitem['bstream'] = array();
                                  $words = $this->maximumWords($inputitem['mode'], $version);
                                  if ($inputitem['size'] > $words) {
                                      $st1 = $this->newInputItem($inputitem['mode'], $words, $inputitem['data']);
                      Severity: Minor
                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                        Function eatNum has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                                 protected function eatNum() {
                                    $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
                                    $p = 0;
                                    while($this->isdigitat($this->dataStr, $p)) {
                                        $p++;
                        Severity: Minor
                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 bitstreamToByte has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                                 protected function bitstreamToByte($bstream) {
                                    $size = count($bstream);
                                    if ($size == 0) {
                                        return array();
                                    }
                        Severity: Minor
                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 estimateBitStreamSize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                 protected function estimateBitStreamSize($items, $version) {
                                    $bits = 0;
                                    if ($version == 0) {
                                        $version = 1;
                                    }
                        Severity: Minor
                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                          Method splitString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                   protected function splitString() {
                                      while (strlen($this->dataStr) > 0) {
                                          if ($this->dataStr == '') {
                                              return 0;
                                          }
                          Severity: Minor
                          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                            Method writeFormatInformation has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                     protected function writeFormatInformation($width, &$frame, $mask, $level) {
                                        $blacks = 0;
                                        $format =  $this->getFormatInfo($mask, $level);
                                        for ($i=0; $i<8; ++$i) {
                                            if ($format & 1) {
                            Severity: Minor
                            Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                              Method eatAn has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                       protected function eatAn() {
                                          $la = $this->lengthIndicator(QR_MODE_AN,  $this->version);
                                          $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
                                          $p = 0;
                                          while($this->isalnumat($this->dataStr, $p)) {
                              Severity: Minor
                              Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                                Method putAlignmentPattern has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                         protected function putAlignmentPattern($version, $frame, $width) {
                                            if ($version < 2) {
                                                return $frame;
                                            }
                                            $d = $this->alignmentPattern[$version][1] - $this->alignmentPattern[$version][0];
                                Severity: Minor
                                Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                                  Function makeMaskNo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                           protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
                                              $b = 0;
                                              $bitMask = array();
                                              $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
                                              if ($maskGenOnly) {
                                  Severity: Minor
                                  Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 maximumWords has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          protected function maximumWords($mode, $version) {
                                              if ($mode == QR_MODE_ST) {
                                                  return 3;
                                              }
                                              if ($version <= 9) {
                                  Severity: Minor
                                  Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          public function __construct($code, $eclevel = 'L') {
                                              $barcode_array = array();
                                              if ((is_null($code)) OR ($code == '\0') OR ($code == '')) {
                                                  return false;
                                              }
                                  Severity: Minor
                                  Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                                    Method mask has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                             protected function mask($width, $frame, $level) {
                                                $minDemerit = PHP_INT_MAX;
                                                $bestMaskNum = 0;
                                                $bestMask = array();
                                                $checked_masks = array(0, 1, 2, 3, 4, 5, 6, 7);
                                    Severity: Minor
                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

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

                                               protected function encode_rs_char($rs, $data, $parity) {
                                                  $MM       =& $rs['mm']; // bits per symbol
                                                  $NN       =& $rs['nn']; // the total number of symbols in a RS block
                                                  $ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form
                                                  $INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form
                                      Severity: Minor
                                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

                                        Function newFromBytes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                                 protected function newFromBytes($size, $data) {
                                                    $bstream = $this->allocate($size * 8);
                                                    $p=0;
                                                    for ($i=0; $i<$size; ++$i) {
                                                        $mask = 0x80;
                                        Severity: Minor
                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 mask has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                                 protected function mask($width, $frame, $level) {
                                                    $minDemerit = PHP_INT_MAX;
                                                    $bestMaskNum = 0;
                                                    $bestMask = array();
                                                    $checked_masks = array(0, 1, 2, 3, 4, 5, 6, 7);
                                        Severity: Minor
                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 generateMaskNo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                                protected function generateMaskNo($maskNo, $width, $frame) {
                                                    $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
                                                    for ($y=0; $y<$width; ++$y) {
                                                        for ($x=0; $x<$width; ++$x) {
                                                            if (ord($frame[$y][$x]) & 0x80) {
                                        Severity: Minor
                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 toUpper has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                                 protected function toUpper() {
                                                    $stringLen = strlen($this->dataStr);
                                                    $p = 0;
                                                    while ($p < $stringLen) {
                                                        $mode = $this->identifyMode(substr($this->dataStr, $p), $this->hint);
                                        Severity: Minor
                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 encodeBitStream has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                                 protected function encodeBitStream($inputitem, $version) {
                                                    $inputitem['bstream'] = array();
                                                    $words = $this->maximumWords($inputitem['mode'], $version);
                                                    if ($inputitem['size'] > $words) {
                                                        $st1 = $this->newInputItem($inputitem['mode'], $words, $inputitem['data']);
                                        Severity: Minor
                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 bitstreamToByte has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                 protected function bitstreamToByte($bstream) {
                                                    $size = count($bstream);
                                                    if ($size == 0) {
                                                        return array();
                                                    }
                                        Severity: Minor
                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 1 hr to fix

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

                                                   protected function appendPaddingBit($bstream) {
                                                      $bits = count($bstream);
                                                      $maxwords = $this->getDataLength($this->version, $this->level);
                                                      $maxbits = $maxwords * 8;
                                                      if ($maxbits == $bits) {
                                          Severity: Minor
                                          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

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

                                                   protected function estimateBitStreamSize($items, $version) {
                                                      $bits = 0;
                                                      if ($version == 0) {
                                                          $version = 1;
                                                      }
                                          Severity: Minor
                                          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

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

                                                   protected function calcParity($items) {
                                                      $parity = 0;
                                                      foreach ($items as $item) {
                                                          if ($item['mode'] != QR_MODE_ST) {
                                                              for ($i=$item['size']-1; $i>=0; --$i) {
                                          Severity: Minor
                                          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if (($b22 | ($w22 ^ 1)) & 1) {
                                                                      $demerit += N2;
                                                                  }
                                          Severity: Major
                                          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 45 mins to fix

                                            Function init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                    protected function init($spec) {
                                                        $dl = $this->rsDataCodes1($spec);
                                                        $el = $this->rsEccCodes1($spec);
                                                        $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
                                                        $blockNo = 0;
                                            Severity: Minor
                                            Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 45 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 has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                     protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
                                            Severity: Minor
                                            Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      if (($this->runLength[$i-2] == $fact)
                                                                          AND ($this->runLength[$i-1] == $fact)
                                                                          AND ($this->runLength[$i+1] == $fact)
                                                                          AND ($this->runLength[$i+2] == $fact)) {
                                                                          if (($this->runLength[$i-3] < 0) OR ($this->runLength[$i-3] >= (4 * $fact))) {
                                              Severity: Major
                                              Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 45 mins to fix

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

                                                        protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
                                                Severity: Minor
                                                Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 45 mins to fix

                                                  Method makeMaskNo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                           protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
                                                  Severity: Minor
                                                  Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 35 mins to fix

                                                    Method qrstrset has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                             protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) {
                                                    Severity: Minor
                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 35 mins to fix

                                                      Function getCode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                              protected function getCode() {
                                                                  if ($this->count < $this->dataLength) {
                                                                      $row = $this->count % $this->blocks;
                                                                      $col = $this->count / $this->blocks;
                                                                      if ($col >= $this->rsblocks[0]['dataLength']) {
                                                      Severity: Minor
                                                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 35 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 checkModeKanji has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                               protected function checkModeKanji($size, $data) {
                                                                  if ($size & 1) {
                                                                      return false;
                                                                  }
                                                                  for ($i=0; $i<$size; $i+=2) {
                                                      Severity: Minor
                                                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 35 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

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                          return true;
                                                      Severity: Major
                                                      Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                            return true;
                                                        Severity: Major
                                                        Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                      return false;
                                                          Severity: Major
                                                          Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return $rs;
                                                            Severity: Major
                                                            Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return NULL;
                                                              Severity: Major
                                                              Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            return $rs;
                                                                Severity: Major
                                                                Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                              return QR_MODE_8B;
                                                                  Severity: Major
                                                                  Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php - About 30 mins to fix

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

                                                                            protected function lengthIndicator($mode, $version) {
                                                                                if ($mode == QR_MODE_ST) {
                                                                                    return 0;
                                                                                }
                                                                                if ($version <= 9) {
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 newFrame has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            protected function newFrame($version) {
                                                                                if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) {
                                                                                    return NULL;
                                                                                }
                                                                                if (!isset($this->frames[$version])) {
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 encodeModeKanji has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                             protected function encodeModeKanji($inputitem, $version) {
                                                                                $inputitem['bstream'] = array();
                                                                                $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x8);
                                                                                $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int)($inputitem['size'] / 2));
                                                                                for ($i=0; $i<$inputitem['size']; $i+=2) {
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 newFromNum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                             protected function newFromNum($bits, $num) {
                                                                                $bstream = $this->allocate($bits);
                                                                                $mask = 1 << ($bits - 1);
                                                                                for ($i=0; $i<$bits; ++$i) {
                                                                                    if ($num & $mask) {
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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 init_rs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                             protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
                                                                                foreach ($this->rsitems as $rs) {
                                                                                    if (($rs['pad'] != $pad) OR ($rs['nroots'] != $nroots) OR ($rs['mm'] != $symsize)
                                                                                        OR ($rs['gfpoly'] != $gfpoly) OR ($rs['fcr'] != $fcr) OR ($rs['prim'] != $prim)) {
                                                                                        continue;
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.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

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

                                                                                for ($i=0; $i < $endfor; ++$i) {
                                                                                    $ecc = array_slice($this->ecccode, $eccPos);
                                                                                    $this->rsblocks[$blockNo] = array();
                                                                                    $this->rsblocks[$blockNo]['dataLength'] = $dl;
                                                                                    $this->rsblocks[$blockNo]['data'] = array_slice($this->datacode, $dataPos);
                                                                    Severity: Major
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php and 1 other location - About 6 hrs to fix
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 880..892

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

                                                                    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

                                                                                for ($i=0; $i < $endfor; ++$i) {
                                                                                    $ecc = array_slice($this->ecccode, $eccPos);
                                                                                    $this->rsblocks[$blockNo] = array();
                                                                                    $this->rsblocks[$blockNo]['dataLength'] = $dl;
                                                                                    $this->rsblocks[$blockNo]['data'] = array_slice($this->datacode, $dataPos);
                                                                    Severity: Major
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php and 1 other location - About 6 hrs to fix
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 903..915

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

                                                                    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 3 locations. Consider refactoring.
                                                                    Open

                                                                                    if ($this->isdigitat($this->dataStr, $p)) {
                                                                                        $q = $p;
                                                                                        while($this->isdigitat($this->dataStr, $q)) {
                                                                                            $q++;
                                                                                        }
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php and 2 other locations - About 40 mins to fix
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 1419..1447
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 1432..1445

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

                                                                    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 3 locations. Consider refactoring.
                                                                    Open

                                                                                    } elseif ($mode == QR_MODE_AN) {
                                                                                        $q = $p;
                                                                                        while($this->isalnumat($this->dataStr, $q)) {
                                                                                            $q++;
                                                                                        }
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php and 2 other locations - About 40 mins to fix
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 1362..1377
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 1419..1447

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

                                                                    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 3 locations. Consider refactoring.
                                                                    Open

                                                                                    if ($mode == QR_MODE_NM) {
                                                                                        $q = $p;
                                                                                        while($this->isdigitat($this->dataStr, $q)) {
                                                                                            $q++;
                                                                                        }
                                                                    Severity: Minor
                                                                    Found in system/lib/phpqrcode/bindings/tcpdf/qrcode.php and 2 other locations - About 40 mins to fix
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 1362..1377
                                                                    system/lib/phpqrcode/bindings/tcpdf/qrcode.php on lines 1432..1445

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

                                                                    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

                                                                    There are no issues that match your filters.

                                                                    Category
                                                                    Status