werneckbh/qr-code

View on GitHub

Showing 91 of 100 total issues

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

    public function writeFormatInformation (int $width, array &$frame, int $mask, int $level) : int
    {
        $blacks = 0;
        $format = Specifications::getFormatInfo($mask, $level);
Severity: Minor
Found in src/QR_Code/Encoder/Mask.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Method next has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function next ()
    {
        do {

            if ($this->bit == -1) {
Severity: Minor
Found in src/QR_Code/Util/FrameFiller.php - About 1 hr to fix

    Method encodeBitStream has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function encodeBitStream (int $version) : int
        {
            try {
                unset($this->bitStream);
                $words = Specifications::maximumWords($this->mode, $version);
    Severity: Minor
    Found in src/QR_Code/Encoder/InputItem.php - About 1 hr to fix

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

          public static function lengthOfCode (int $mode, int $version, $bits)
          {
              $payload = $bits - 4 - Specifications::lengthIndicator($mode, $version);
              switch ($mode) {
                  case QR_MODE_NUM:
      Severity: Minor
      Found in src/QR_Code/Encoder/Input.php - About 1 hr to fix

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

            public function encodeBitStream (int $version) : int
            {
                try {
                    unset($this->bitStream);
                    $words = Specifications::maximumWords($this->mode, $version);
        Severity: Minor
        Found in src/QR_Code/Encoder/InputItem.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 lengthOfCode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function lengthOfCode (int $mode, int $version, $bits)
            {
                $payload = $bits - 4 - Specifications::lengthIndicator($mode, $version);
                switch ($mode) {
                    case QR_MODE_NUM:
        Severity: Minor
        Found in src/QR_Code/Encoder/Input.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 identifyMode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function identifyMode (int $pos) : int
            {
                if ($pos >= strlen($this->dataStr))
                    return QR_MODE_NUL;
        
        Severity: Minor
        Found in src/QR_Code/Util/Split.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

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

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

              public function writeFormatInformation (int $width, array &$frame, int $mask, int $level) : int
              {
                  $blacks = 0;
                  $format = Specifications::getFormatInfo($mask, $level);
          
          Severity: Minor
          Found in src/QR_Code/Encoder/Mask.php - About 1 hr to fix

            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 factory has 31 lines of code (exceeds 25 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 1 hr to fix

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

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

                    public function init (array $spec) : int
                    {
                        $dl = Specifications::rsDataCodes1($spec);
                        $el = Specifications::rsEccCodes1($spec);
                        $rs = Rs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
                Severity: Minor
                Found in src/QR_Code/Encoder/RawCode.php - About 1 hr to fix

                  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

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

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

                          public static function eps (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, bool $cmyk = false) : void
                      Severity: Major
                      Found in src/QR_Code/QR_Code.php - About 1 hr to fix

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

                          Method makeMaskNo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function makeMaskNo ($maskNo, $width, $s, &$d, $maskGenOnly = false)
                              {
                                  $b = 0;
                                  $bitMask = [];
                          
                          Severity: Minor
                          Found in src/QR_Code/Encoder/Mask.php - About 1 hr to fix

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

                              Method encode_rs_char has 27 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language