CORE-POS/IS4C

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

Summary

Maintainability
C
1 day
Test Coverage

File AuthorizeDotNet.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2007,2010 Whole Foods Co-op

Severity: Minor
Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.php - About 2 hrs to fix

    Method sendAuth has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function sendAuth()
        {
            // initialize
            $dbTrans = PaycardLib::paycard_db();
            if( !$dbTrans){
    Severity: Minor
    Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.php - About 2 hrs to fix

      Method sendVoid has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function sendVoid()
          {
              // initialize
              $dbTrans = PaycardLib::paycard_db();
              if( !$dbTrans){
      Severity: Minor
      Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.php - About 1 hr to fix

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

            protected function handleResponseAuth($authResult)
            {
                $xml = new XmlData($authResult['response']);
                $request = $this->last_request;
                $this->last_paycard_transaction_id = $request->last_paycard_transaction_id;
        Severity: Minor
        Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.php - About 1 hr to fix

          Function responseReturn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private function responseReturn($xml)
              {
                  switch ($xml->get("RESPONSECODE")) {
                      case 1: // APPROVED
                          return PaycardLib::PAYCARD_ERR_OK;
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.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 responseReturn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function responseReturn($xml)
              {
                  switch ($xml->get("RESPONSECODE")) {
                      case 1: // APPROVED
                          return PaycardLib::PAYCARD_ERR_OK;
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.php - About 1 hr to fix

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

                public function cleanup($json)
                {
                    switch($this->conf->get("paycard_mode")){
                    case PaycardLib::PAYCARD_MODE_AUTH:
                        // cast to string. tender function expects string input
            Severity: Minor
            Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.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 sendAuth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function sendAuth()
                {
                    // initialize
                    $dbTrans = PaycardLib::paycard_db();
                    if( !$dbTrans){
            Severity: Minor
            Found in pos/is4c-nf/plugins/Paycards/AuthorizeDotNet.php - About 45 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