werneckbh/qr-code

View on GitHub
src/QR_Code/Config/Specifications.php

Summary

Maintainability
C
1 day
Test Coverage

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

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

    Method debug has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

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

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

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

        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 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function newFrame ($version)
            {
                if ($version < 1 || $version > QRSPEC_VERSION_MAX)
                    return null;
        
        Severity: Minor
        Found in src/QR_Code/Config/Specifications.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 putAlignmentPattern has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function putAlignmentPattern ($version, &$frame, $width)
            {
                if ($version < 2)
                    return;
        
        Severity: Minor
        Found in src/QR_Code/Config/Specifications.php - About 1 hr to fix

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

              public static function putAlignmentPattern ($version, &$frame, $width)
              {
                  if ($version < 2)
                      return;
          
          Severity: Minor
          Found in src/QR_Code/Config/Specifications.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

          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

          There are no issues that match your filters.

          Category
          Status