werneckbh/qr-code

View on GitHub

Showing 91 of 100 total issues

Method toByte has 26 lines of code (exceeds 25 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 1 hr to fix

    Method png has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function png (string $text, $outfile = false, $level = QR_ECLEVEL_L, int $size = 3, int $margin = 4, bool $saveAndPrint = false, int $back_color = QR_WHITE, int $fore_color = QR_BLACK) : void
    Severity: Major
    Found in src/QR_Code/QR_Code.php - About 1 hr to fix

      Method eps has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function eps ($frame, $filename = false, int $pixelPerPoint = 4, int $outerFrame = 4, bool $saveAndPrint = false, int $backColor = 0xFFFFFF, int $foreColor = 0x000000, bool $cmyk = false) : void
      Severity: Major
      Found in src/QR_Code/Encoder/Vector.php - About 1 hr to fix

        Method svg has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function svg (string $text, $outfile = false, $level = QR_ECLEVEL_L, int $size = 3, int $margin = 4, bool $saveAndPrint = false, int $back_color = QR_WHITE, int $fore_color = QR_BLACK) : void
        Severity: Major
        Found in src/QR_Code/QR_Code.php - About 1 hr to fix

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

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

          Cognitive Complexity

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

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

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

          Further reading

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

              public function convertData () : int
              {
                  $ver = $this->estimateVersion();
                  if ($ver > $this->getVersion()) {
                      $this->setVersion($ver);
          Severity: Minor
          Found in src/QR_Code/Encoder/Input.php - About 55 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Method png has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function png (array $frame, $filename = false, int $pixelPerPoint = 4, int $outerFrame = 4, bool $saveAndPrint = false, int $backColor = QR_WHITE, int $foreColor = QR_BLACK) : void
          Severity: Major
          Found in src/QR_Code/Encoder/Image.php - About 50 mins to fix

            Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function __construct (string $type, bool $pref = true, string $street, string $city, string $state, string $zip, string $country)
            Severity: Major
            Found in src/QR_Code/Types/vCard/Address.php - About 50 mins to fix

              Method svg has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function svg ($frame, $filename = false, int $pixelPerPoint = 4, int $outerFrame = 4, bool $saveAndPrint = false, int $backColor, int $foreColor) : void
              Severity: Major
              Found in src/QR_Code/Encoder/Vector.php - About 50 mins to fix

                Method factory has 6 arguments (exceeds 4 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
                Severity: Minor
                Found in src/QR_Code/Encoder/Encoder.php - About 45 mins to fix

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

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

                  Avoid deeply nested control flow statements.
                  Open

                                          if (($this->runLength[$i - 3] < 0) || ($this->runLength[$i - 3] >= (4 * $fact))) {
                                              $demerit += N3;
                                          } elseif ((($i + 3) >= $length) || ($this->runLength[$i + 3] >= (4 * $fact))) {
                                              $demerit += N3;
                                          }
                  Severity: Major
                  Found in src/QR_Code/Encoder/Mask.php - About 45 mins to fix

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

                        private static function vectEPS ($frame, int $pixelPerPoint = 4, int $outerFrame = 4, int $backColor = 0xFFFFFF, int $foreColor = 0x000000, bool $cmyk = false) : string
                    Severity: Minor
                    Found in src/QR_Code/Encoder/Vector.php - About 45 mins to fix

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

                          private static function vectEPS ($frame, int $pixelPerPoint = 4, int $outerFrame = 4, int $backColor = 0xFFFFFF, int $foreColor = 0x000000, bool $cmyk = false) : string
                          {
                              $h = count($frame);
                              $w = strlen($frame[0]);
                      
                      Severity: Minor
                      Found in src/QR_Code/Encoder/Vector.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function __construct (string $firstName, string $lastName, string $title = '', string $email, string $org = '', string $orgTitle = '')
                      Severity: Minor
                      Found in src/QR_Code/Types/vCard/Person.php - About 45 mins to fix

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

                            public function toUpper () : string
                            {
                                $stringLen = strlen($this->dataStr);
                                $p = 0;
                        
                        Severity: Minor
                        Found in src/QR_Code/Util/Split.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_char has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

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

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

                              public function appendPaddingBit (BitStream &$bitStream) : int
                              {
                                  $bits = $bitStream->size();
                                  $maxwords = Specifications::getDataLength($this->version, $this->level);
                                  $maxbits = $maxwords * 8;
                          Severity: Minor
                          Found in src/QR_Code/Encoder/Input.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 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 check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function check (int $mode, int $size, $data) : bool
                              {
                                  if ($size <= 0)
                                      return false;
                          
                          Severity: Minor
                          Found in src/QR_Code/Encoder/Input.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

                          Severity
                          Category
                          Status
                          Source
                          Language