File MercuryDC.php
has 790 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use COREPOS\pos\lib\Database;
use COREPOS\pos\lib\ReceiptLib;
use COREPOS\pos\lib\TransRecord;
Method handleResponseDataCap
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleResponseDataCap($xml)
{
$rawXml = $xml;
$ref = $this->refnum($this->conf->get('paycard_id'));
$transID = $this->conf->get('paycard_id');
Function prepareDataCapAuth
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function prepareDataCapAuth($type, $amount, $prompt=false)
{
$request = new PaycardRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
$request->setProcessor($this->proc_name);
$tranCode = $amount > 0 ? 'Sale' : 'Return';
- 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 wicReceiptHandler
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private function wicReceiptHandler($dbc, $xml, $transID)
{
if ($xml->query('/RStream/TranResponse/TranCode') == 'ReverseSale') {
$clearP = $dbc->prepare('DELETE FROM EmvReceipt WHERE dateID=? AND empNo=? AND registerNo=? AND transNo=? AND transID=?');
$dbc->execute($clearP, array(
- 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 prepareDataCapVoid
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareDataCapVoid($pcID)
{
$dbc = Database::tDataConnect();
$prep = $dbc->prepare('SELECT transNo, registerNo FROM PaycardTransactions WHERE paycardTransactionID=?');
$row = $dbc->getRow($prep, $pcID);
Method prepareDataCapAuth
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareDataCapAuth($type, $amount, $prompt=false)
{
$request = new PaycardRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
$request->setProcessor($this->proc_name);
$tranCode = $amount > 0 ? 'Sale' : 'Return';
Function prepareDataCapVoid
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function prepareDataCapVoid($pcID)
{
$dbc = Database::tDataConnect();
$prep = $dbc->prepare('SELECT transNo, registerNo FROM PaycardTransactions WHERE paycardTransactionID=?');
$row = $dbc->getRow($prep, $pcID);
- 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 handleResponseDataCap
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function handleResponseDataCap($xml)
{
$rawXml = $xml;
$ref = $this->refnum($this->conf->get('paycard_id'));
$transID = $this->conf->get('paycard_id');
- 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 wicReceiptHandler
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function wicReceiptHandler($dbc, $xml, $transID)
{
if ($xml->query('/RStream/TranResponse/TranCode') == 'ReverseSale') {
$clearP = $dbc->prepare('DELETE FROM EmvReceipt WHERE dateID=? AND empNo=? AND registerNo=? AND transNo=? AND transID=?');
$dbc->execute($clearP, array(
Method prepareDataCapBalance
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareDataCapBalance($type, $prompt=false)
{
$this->conf->set('DatacapBalanceCheck', '??');
$this->conf->set('EWICBalance', '??');
$termID = $this->getTermID();
Method handleResponseDataCapBalance
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleResponseDataCapBalance($xml)
{
$better = new BetterXmlData($xml);
$responseCode = $better->query('/RStream/CmdResponse/CmdStatus');
$validResponse = -3;
Function eWicBalanceToArray
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function eWicBalanceToArray($xml)
{
$ret = array();
$dbc = Database::tDataConnect();
$catP = $dbc->prepare('SELECT * FROM ' . $this->conf->get('pDatabase') . $dbc->sep() . 'EWicCategories WHERE eWicCategoryID=?');
- 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 prepareDataCapGift
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareDataCapGift($mode, $amount, $prompt)
{
$request = new PaycardGiftRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
$request->setProcessor($this->proc_name);
Method prepareDataCapWic
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareDataCapWic($itemData, $tranCode, $last4, $prompt=false)
{
$request = new PaycardRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
$request->setProcessor($this->proc_name);
Function prepareDataCapBalance
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function prepareDataCapBalance($type, $prompt=false)
{
$this->conf->set('DatacapBalanceCheck', '??');
$this->conf->set('EWICBalance', '??');
$termID = $this->getTermID();
- 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 handleResponseDataCapBalance
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function handleResponseDataCapBalance($xml)
{
$better = new BetterXmlData($xml);
$responseCode = $better->query('/RStream/CmdResponse/CmdStatus');
$validResponse = -3;
- 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 eWicBalanceToArray
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function eWicBalanceToArray($xml)
{
$ret = array();
$dbc = Database::tDataConnect();
$catP = $dbc->prepare('SELECT * FROM ' . $this->conf->get('pDatabase') . $dbc->sep() . 'EWicCategories WHERE eWicCategoryID=?');
Function eWicBalanceToString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function eWicBalanceToString($data)
{
$ret = "";
foreach ($data as $row) {
- 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"