dwmsw/sagepay

View on GitHub

Showing 15 of 15 total issues

Method getCountryCodes has 248 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getCountryCodes()
    {
        return array
        (
            'AF' => 'Afghanistan',
Severity: Major
Found in src/Utilities.php - About 1 day to fix

    File Utilities.php has 361 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Common functions that can be used across all methods
     */
    
    
    Severity: Minor
    Found in src/Utilities.php - About 4 hrs to fix

      Shared has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Shared extends AbstractSettings
      {
      
          /**
           * Sets the connection mode for the API
      Severity: Minor
      Found in src/Shared.php - About 4 hrs to fix

        Method getCurrencies has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getCurrencies()
            {
                return array(
                    'AFA' => array('Afghan Afghani', '971'),
                    'AWG' => array('Aruban Florin', '533'),
        Severity: Major
        Found in src/Utilities.php - About 4 hrs to fix

          Method register has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function register($txType)
              {
                  if (in_array(strtoupper($txType), $this->validTxTypes)) {
                      $txType = strtoupper($txType);
                  } else {
          Severity: Major
          Found in src/Direct.php - About 2 hrs to fix

            Method repeat has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function repeat()
                {
                    $data = array(
                        'VPSProtocol'        => $this->protocol,
                        'TxType'             => "REPEAT",
            Severity: Minor
            Found in src/Direct.php - About 1 hr to fix

              Function setAddress has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setAddress($address1, $address2, $city, $country, $postcode, $state = false)
                  {
                      $countries = Utilities::getCountryCodes();
              
                      if (strlen($address1) > 100) {
              Severity: Minor
              Found in src/Address.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 toXml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function toXml()
                  {
                      $dom = new \DOMDocument();
                      $dom->formatOutput = true;
                      $dom->loadXML('<basket></basket>');
              Severity: Minor
              Found in src/Basket.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 toXml has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function toXml()
                  {
                      $dom = new \DOMDocument();
                      $dom->formatOutput = true;
                      $dom->loadXML('<basket></basket>');
              Severity: Minor
              Found in src/Basket.php - About 1 hr to fix

                Method setAddress has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function setAddress($address1, $address2, $city, $country, $postcode, $state = false)
                    {
                        $countries = Utilities::getCountryCodes();
                
                        if (strlen($address1) > 100) {
                Severity: Minor
                Found in src/Address.php - About 1 hr to fix

                  Method refund has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function refund($VendorTxCode, $Amount, $RelatedVPSTxId, $RelatedVendorTxCode, $RelatedSecurityKey, $RelatedTxAuthNo, $Description = '')
                  Severity: Major
                  Found in src/Direct.php - About 50 mins to fix

                    Method authorise has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function authorise($VendorTxCode, $Amount, $RelatedVPSTxId, $RelatedVendorTxCode, $RelatedSecurityKey, $RelatedTxAuthNo, $Description = '')
                    Severity: Major
                    Found in src/Direct.php - About 50 mins to fix

                      Method setAddress has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function setAddress($address1, $address2, $city, $country, $postcode, $state = false)
                      Severity: Minor
                      Found in src/Address.php - About 45 mins to fix

                        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function __construct($description, $unitNetAmount, $unitTaxAmount, $quantity = 1, $productCode = false, $productSku = false) 
                        Severity: Minor
                        Found in src/Item.php - About 45 mins to fix

                          Method release has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function release($VPSTxId, $SecurityKey, $VendorTxCode, $TxAuthNo, $ReleaseAmount)
                          Severity: Minor
                          Found in src/Direct.php - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language