CORE-POS/IS4C

View on GitHub
pos/is4c-nf/plugins/Paycards/MercuryDC.php

Summary

Maintainability
F
1 wk
Test Coverage

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;
Severity: Major
Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 1 day to fix

    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');
    Severity: Major
    Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 5 hrs to fix

      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';
      Severity: Minor
      Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 5 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

      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(
      Severity: Minor
      Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 5 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 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);
      Severity: Major
      Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 4 hrs to fix

        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';
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 4 hrs to fix

          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);
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 4 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

          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');
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 4 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 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(
          Severity: Major
          Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 3 hrs to fix

            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();
            Severity: Major
            Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 2 hrs to fix

              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;
              Severity: Minor
              Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 2 hrs to fix

                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=?');
                Severity: Minor
                Found in pos/is4c-nf/plugins/Paycards/MercuryDC.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 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);
                
                
                Severity: Minor
                Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 1 hr to fix

                  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);
                  
                  
                  Severity: Minor
                  Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 1 hr to fix

                    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;
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/MercuryDC.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

                    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();
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/MercuryDC.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 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=?');
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 1 hr to fix

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

                          private function eWicBalanceToString($data)
                          {
                              $ret = "";
                              foreach ($data as $row) {
                      
                      
                      Severity: Minor
                      Found in pos/is4c-nf/plugins/Paycards/MercuryDC.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

                      There are no issues that match your filters.

                      Category
                      Status