CORE-POS/IS4C

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

Summary

Maintainability
F
1 wk
Test Coverage

File MercuryE2E.php has 818 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2012 Whole Foods Co-op

Severity: Major
Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 1 day to fix

    Method lookupTransaction has 137 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function lookupTransaction($ref, $local, $mode)
        {
            $wsParams = array(
                'merchant' => $this->conf->get('MercuryE2ETerminalID'),
                'pw' => $this->conf->get('MercuryE2EPassword'),
    Severity: Major
    Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 5 hrs to fix

      Method cleanup has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function cleanup($json)
          {
              switch ($this->conf->get("paycard_mode")) {
                  case PaycardLib::PAYCARD_MODE_ADDVALUE:
                  case PaycardLib::PAYCARD_MODE_ACTIVATE:
      Severity: Major
      Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 4 hrs to fix

        Method handleResponseAuth has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function handleResponseAuth($authResult)
            {
                $resp = $this->desoapify("CreditTransactionResult",
                    $authResult["response"]);
                $xml = new XmlData($resp);
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 3 hrs to fix

          Function lookupTransaction has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              public function lookupTransaction($ref, $local, $mode)
              {
                  $wsParams = array(
                      'merchant' => $this->conf->get('MercuryE2ETerminalID'),
                      'pw' => $this->conf->get('MercuryE2EPassword'),
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 3 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 sendAuth has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function sendAuth($domain="w1.mercurypay.com")
              {
                  // initialize
                  $dbTrans = PaycardLib::paycard_db();
                  if (!$dbTrans) {
          Severity: Major
          Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 hrs to fix

            MercuryE2E has 25 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class MercuryE2E extends BasicCCModule 
            {
                private $voidTrans;
                private $voidRef;
                protected $SOAPACTION = "http://www.mercurypay.com/CreditTransaction";
            Severity: Minor
            Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 hrs to fix

              Function handleResponseAuth has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function handleResponseAuth($authResult)
                  {
                      $resp = $this->desoapify("CreditTransactionResult",
                          $authResult["response"]);
                      $xml = new XmlData($resp);
              Severity: Minor
              Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 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 cleanup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function cleanup($json)
                  {
                      switch ($this->conf->get("paycard_mode")) {
                          case PaycardLib::PAYCARD_MODE_ADDVALUE:
                          case PaycardLib::PAYCARD_MODE_ACTIVATE:
              Severity: Minor
              Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 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 sendVoid has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function sendVoid($skipReversal=False,$domain="w1.mercurypay.com")
                  {
                      // initialize
                      $dbTrans = PaycardLib::paycard_db();
                      if (!$dbTrans){
              Severity: Major
              Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 hrs to fix

                Method handleResponseVoid has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function handleResponseVoid($authResult)
                    {
                        $resp = $this->desoapify("CreditTransactionResult",
                            $authResult["response"]);
                        $xml = new XmlData($resp);
                Severity: Major
                Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 hrs to fix

                  Function sendAuth has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function sendAuth($domain="w1.mercurypay.com")
                      {
                          // initialize
                          $dbTrans = PaycardLib::paycard_db();
                          if (!$dbTrans) {
                  Severity: Minor
                  Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.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 beginXmlRequest has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function beginXmlRequest($request, $refNo=false, $recordNo=false, $tipped=false)
                      {
                          $termID = $this->getTermID();
                          $separateID = false;
                          if (substr($termID, -2) == '::') {
                  Severity: Minor
                  Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 1 hr to fix

                    Function beginXmlRequest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function beginXmlRequest($request, $refNo=false, $recordNo=false, $tipped=false)
                        {
                            $termID = $this->getTermID();
                            $separateID = false;
                            if (substr($termID, -2) == '::') {
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.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 handleResponseVoid has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function handleResponseVoid($authResult)
                        {
                            $resp = $this->desoapify("CreditTransactionResult",
                                $authResult["response"]);
                            $xml = new XmlData($resp);
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 55 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

                    Function sendVoid has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function sendVoid($skipReversal=False,$domain="w1.mercurypay.com")
                        {
                            // initialize
                            $dbTrans = PaycardLib::paycard_db();
                            if (!$dbTrans){
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 55 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

                    Avoid too many return statements within this method.
                    Open

                            return PaycardLib::PAYCARD_ERR_PROC;
                    Severity: Major
                    Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return PaycardLib::PAYCARD_ERR_NSF_RETRY;
                      Severity: Major
                      Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return PaycardLib::PAYCARD_ERR_PROC;
                        Severity: Major
                        Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 30 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status