amtgard/ORK3

View on GitHub
system/lib/phpqrcode/qrencode.php

Summary

Maintainability
F
2 wks
Test Coverage

File qrencode.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * PHP QR Code encoder
 *
 * Main encoder classes.
Severity: Minor
Found in system/lib/phpqrcode/qrencode.php - About 4 hrs to fix

    Function next has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

            public function next()
            {
                do {
                
                    if($this->bit == -1) {
    Severity: Minor
    Found in system/lib/phpqrcode/qrencode.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 encodeMask has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function encodeMask(QRinput $input, $mask)
            {
                if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
                    throw new Exception('wrong version');
                }
    Severity: Major
    Found in system/lib/phpqrcode/qrencode.php - About 2 hrs to fix

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

              public function encodeMask(QRinput $input, $mask)
              {
                  if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
                      throw new Exception('wrong version');
                  }
      Severity: Minor
      Found in system/lib/phpqrcode/qrencode.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 system/lib/phpqrcode/qrencode.php - About 1 hr to fix

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

                public function init(array $spec)
                {
                    $dl = QRspec::rsDataCodes1($spec);
                    $el = QRspec::rsEccCodes1($spec);
                    $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
        Severity: Minor
        Found in system/lib/phpqrcode/qrencode.php - About 1 hr to fix

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

                  public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
                  {
                      $enc = new QRencode();
                      $enc->size = $size;
                      $enc->margin = $margin;
          Severity: Minor
          Found in system/lib/phpqrcode/qrencode.php - About 1 hr to fix

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

                    public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false) 
            Severity: Minor
            Found in system/lib/phpqrcode/qrencode.php - About 45 mins to fix

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

                      public function encodeString($string, $version, $level, $hint, $casesensitive)
              Severity: Minor
              Found in system/lib/phpqrcode/qrencode.php - About 35 mins to fix

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

                        public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4) 
                Severity: Minor
                Found in system/lib/phpqrcode/qrencode.php - About 35 mins to fix

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

                          public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
                  Severity: Minor
                  Found in system/lib/phpqrcode/qrencode.php - About 35 mins to fix

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

                            public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4) 
                    Severity: Minor
                    Found in system/lib/phpqrcode/qrencode.php - About 35 mins to fix

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

                              public function getCode()
                              {
                                  $ret;
                      
                                  if($this->count < $this->dataLength) {
                      Severity: Minor
                      Found in system/lib/phpqrcode/qrencode.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 factory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
                              {
                                  $enc = new QRencode();
                                  $enc->size = $size;
                                  $enc->margin = $margin;
                      Severity: Minor
                      Found in system/lib/phpqrcode/qrencode.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

                          class QRcode {
                          
                              public $version;
                              public $width;
                              public $data; 
                      Severity: Major
                      Found in system/lib/phpqrcode/qrencode.php and 1 other location - About 6 days to fix
                      system/lib/phpqrcode/phpqrcode.php on lines 2964..3110

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

                      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

                          class QRrawcode {
                              public $version;
                              public $datacode = array();
                              public $ecccode = array();
                              public $blocks;
                      Severity: Major
                      Found in system/lib/phpqrcode/qrencode.php and 1 other location - About 5 days to fix
                      system/lib/phpqrcode/phpqrcode.php on lines 2855..2960

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

                      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

                          class QRencode {
                          
                              public $casesensitive = true;
                              public $eightbit = false;
                              
                      Severity: Major
                      Found in system/lib/phpqrcode/qrencode.php and 1 other location - About 3 days to fix
                      system/lib/phpqrcode/phpqrcode.php on lines 3204..3310

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

                      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

                          class FrameFiller {
                          
                              public $width;
                              public $frame;
                              public $x;
                      Severity: Major
                      Found in system/lib/phpqrcode/qrencode.php and 1 other location - About 2 days to fix
                      system/lib/phpqrcode/phpqrcode.php on lines 3114..3200

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

                      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

                          class QRrsblock {
                              public $dataLength;
                              public $data = array();
                              public $eccLength;
                              public $ecc = array();
                      Severity: Major
                      Found in system/lib/phpqrcode/qrencode.php and 1 other location - About 1 hr to fix
                      system/lib/phpqrcode/phpqrcode.php on lines 2836..2851

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

                      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