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);
- Read upRead up
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) {
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);
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:
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);
- Read upRead up
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:
- Read upRead up
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;
- Read upRead up
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());
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);
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;
- Read upRead up
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;
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]);
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);
Method putAlignmentPattern
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function putAlignmentPattern ($version, &$frame, $width)
{
if ($version < 2)
return;
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 = [];
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
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;
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 = [];
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;
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;