Function paycard_entered
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function paycard_entered($mode,$card,$manual,$type)
{
$ret = $this->default_json();
// initialize
$validate = true; // run Luhn's on PAN, check expiration date
- 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 paycard_entered
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function paycard_entered($mode,$card,$manual,$type)
{
$ret = $this->default_json();
// initialize
$validate = true; // run Luhn's on PAN, check expiration date
Consider simplifying this complex logical expression. Open
if (substr($str,-1,1) == "?"){
return true;
} elseif ($this->isE2E($str) || $this->isE2E(substr($str, 2))) {
$this->swipetype = PaycardLib::PAYCARD_TYPE_ENCRYPTED;
return true;
Function initAmount
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function initAmount($type)
{
/* assign amount due. EBT food should use eligible amount */
$this->conf->set("paycard_amount",$this->conf->get("amtdue"));
if ($type == 'EBTFOOD'){
- 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 check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function check($str)
{
$this->swipetype = PaycardLib::PAYCARD_TYPE_UNKNOWN;
if (substr($str,-1,1) == "?"){
return true;
- 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
Avoid too many return
statements within this method. Open
return false;
Function parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function parse($str)
{
$ret = array();
if ($this->interceptVoid) {
$ret['main_frame'] = $this->interceptVoid;
- 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"