werneckbh/qr-code

View on GitHub

Showing 100 of 100 total issues

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

    public static function checkModeKanji (int $size, $data) : bool
    {
        if ($size & 1)
            return false;
Severity: Minor
Found in src/QR_Code/Encoder/Input.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 generateMaskNo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateMaskNo ($maskNo, int $width, array $frame) : array
    {
        $bitMask = array_fill(0, $width, array_fill(0, $width, 0));

        for ($y = 0; $y < $width; $y++) {
Severity: Minor
Found in src/QR_Code/Encoder/Mask.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 newFromBytes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function newFromBytes ($size, $data) : BitStream
    {
        $bitStream = new self();
        $bitStream->allocate($size * 8);
        $p = 0;
Severity: Minor
Found in src/QR_Code/Encoder/BitStream.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 toByte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function toByte () : array
    {
        $size = $this->size();

        if ($size == 0) {
Severity: Minor
Found in src/QR_Code/Encoder/BitStream.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 log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function log ($outfile, string $err) : void
    {
        if (QR_LOG_DIR !== false) {
            if ($err != '') {
                $data = date('Y-m-d H:i:s') . ': ' . $err . PHP_EOL;
Severity: Minor
Found in src/QR_Code/Util/Logger.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 vectSVG has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function vectSVG ($frame, int $pixelPerPoint = 4, int $outerFrame = 4, int $backColor = 0xFFFFFF, int $foreColor = 0x000000) : string
    {
        $h = count($frame);
        $w = strlen($frame[0]);
Severity: Minor
Found in src/QR_Code/Encoder/Vector.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 $rs;
Severity: Major
Found in src/QR_Code/Encoder/ErrorCorrection/RsItem.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in src/QR_Code/Encoder/Input.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return QR_MODE_8;
      Severity: Major
      Found in src/QR_Code/Util/Split.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

                          return true;
          Severity: Major
          Found in src/QR_Code/Encoder/Input.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return true;
            Severity: Major
            Found in src/QR_Code/Encoder/Input.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

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

                Avoid too many return statements within this method.
                Open

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

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

                      public function estimateBitStreamSizeOfEntry (int $version)
                      {
                          if ($version == 0)
                              $version = 1;
                  
                  Severity: Minor
                  Found in src/QR_Code/Encoder/InputItem.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 debug has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function debug ($frame, $binary_mode = false)
                      {
                          if ($binary_mode) {
                  
                              foreach ($frame as &$frameLine) {
                  Severity: Minor
                  Found in src/QR_Code/Config/Specifications.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 calcParity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function calcParity () : int
                      {
                          $parity = 0;
                  
                          foreach ($this->items as $item) {
                  Severity: Minor
                  Found in src/QR_Code/Encoder/Input.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 mask has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function mask (int $width, array $frame, int $level) : array
                      {
                          $minDemerit = PHP_INT_MAX;
                          $bestMaskNum = 0;
                          $bestMask = [];
                  Severity: Minor
                  Found in src/QR_Code/Encoder/Mask.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 image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function image (array $frame, int $pixelPerPoint = 4, int $outerFrame = 4, int $backColor = QR_WHITE, int $foreColor = QR_BLACK)
                      {
                          $h = count($frame);
                          $w = strlen($frame[0]);
                  
                  Severity: Minor
                  Found in src/QR_Code/Encoder/Image.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 factory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function factory ($level = QR_ECLEVEL_L, int $size = 3, int $margin = 4, int $backColor = QR_WHITE, int $foreColor = QR_BLACK, bool $cmyk = false) : Encoder
                      {
                          $enc = new self();
                          $enc->size = $size;
                          $enc->margin = $margin;
                  Severity: Minor
                  Found in src/QR_Code/Encoder/Encoder.php - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language