src/QR_Code/Encoder/ErrorCorrection/RsItem.php
Function init_rs_char
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
{
// Common code for intializing a Reed-Solomon control block (char or int symbols)
// Copyright 2004 Phil Karn, KA9Q
// May be used under the terms of the GNU Lesser General Public License (LGPL)
- 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 init_rs_char
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
{
// Common code for intializing a Reed-Solomon control block (char or int symbols)
// Copyright 2004 Phil Karn, KA9Q
// May be used under the terms of the GNU Lesser General Public License (LGPL)
Method encode_rs_char
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function encode_rs_char ($data, &$parity)
{
$MM =& $this->mm;
$NN =& $this->nn;
$ALPHA_TO =& $this->alpha_to;
Function encode_rs_char
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
public function encode_rs_char ($data, &$parity)
{
$MM =& $this->mm;
$NN =& $this->nn;
$ALPHA_TO =& $this->alpha_to;
- 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 init_rs_char
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
Avoid too many return
statements within this method. Open
Open
return $rs;
Avoid too many return
statements within this method. Open
Open
return $rs;
Avoid too many return
statements within this method. Open
Open
if ($pad < 0 || $pad >= ((1 << $symsize) - 1 - $nroots)) return $rs; // Too much padding