wp-pay-gateways/adyen

View on GitHub

Showing 80 of 94 total issues

File Integration.php has 500 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Integration
 *
 * @author    Pronamic <info@pronamic.eu>
Severity: Minor
Found in src/Integration.php - About 1 day to fix

    Method get_settings_fields has 191 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_settings_fields() {
            $fields = array();
    
            // Merchant Account.
            $fields[] = array(
    Severity: Major
    Found in src/Integration.php - About 7 hrs to fix

      AbstractPaymentRequest has 41 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class AbstractPaymentRequest extends Request {
          /**
           * Additional data.
           *
           * @var AdditionalData|null
      Severity: Minor
      Found in src/AbstractPaymentRequest.php - About 5 hrs to fix

        File PaymentsController.php has 385 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Payments controller
         *
         * @author    Pronamic <info@pronamic.eu>
        Severity: Minor
        Found in src/PaymentsController.php - About 5 hrs to fix

          Function complement has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function complement( Payment $payment, AbstractPaymentRequest $request ) {
                  // Channel.
                  $request->set_channel( Channel::WEB );
          
                  // Shopper.
          Severity: Minor
          Found in src/PaymentRequestHelper.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 payment_redirect has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function payment_redirect( Payment $payment ) {
                  // Check payment ID.
                  $payment_id = $payment->get_id();
          
                  if ( null === $payment_id ) {
          Severity: Major
          Found in src/DropInGateway.php - About 4 hrs to fix

            Method rest_api_applepay_merchant_validation has 116 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function rest_api_applepay_merchant_validation( WP_REST_Request $request ) {
                    $payment_id = $request->get_param( 'payment_id' );
            
                    // Payment ID.
                    if ( null === $payment_id ) {
            Severity: Major
            Found in src/PaymentsController.php - About 4 hrs to fix

              File DropInGateway.php has 343 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Drop-in gateway
               *
               * @author    Pronamic <info@pronamic.eu>
              Severity: Minor
              Found in src/DropInGateway.php - About 4 hrs to fix

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

                    public function rest_api_adyen_payments( WP_REST_Request $request ) {
                        $payment_id = $request->get_param( 'payment_id' );
                
                        // Payment ID.
                        if ( null === $payment_id ) {
                Severity: Major
                Found in src/PaymentsController.php - About 3 hrs to fix

                  Method complement has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function complement( Payment $payment, AbstractPaymentRequest $request ) {
                          // Channel.
                          $request->set_channel( Channel::WEB );
                  
                          // Shopper.
                  Severity: Major
                  Found in src/PaymentRequestHelper.php - About 3 hrs to fix

                    Function save_post has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function save_post( $post_id ) {
                            // Files.
                            $files = array(
                                '_pronamic_gateway_adyen_apple_pay_merchant_id_certificate_file' => '_pronamic_gateway_adyen_apple_pay_merchant_id_certificate',
                                '_pronamic_gateway_adyen_apple_pay_merchant_id_private_key_file' => '_pronamic_gateway_adyen_apple_pay_merchant_id_private_key',
                    Severity: Minor
                    Found in src/Integration.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

                    Function get_issuers has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function get_issuers() {
                            $issuers = array();
                    
                            try {
                                $payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->adyen_config->get_merchant_account() ) );
                    Severity: Minor
                    Found in src/AbstractGateway.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 rest_api_adyen_payment_details has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function rest_api_adyen_payment_details( WP_REST_Request $request ) {
                            $payment_id = $request->get_param( 'payment_id' );
                    
                            // Payment ID.
                            if ( null === $payment_id ) {
                    Severity: Major
                    Found in src/PaymentsController.php - About 3 hrs to fix

                      Method get_http_authorization_test has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function get_http_authorization_test() {
                              $result = array(
                                  'label'       => __( 'HTTP Basic authentication is working', 'pronamic_ideal' ),
                                  'status'      => 'good',
                                  'badge'       => array(
                      Severity: Major
                      Found in src/SiteHealthController.php - About 3 hrs to fix

                        Function update_status has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function update_status( Payment $payment ) {
                                // Process payload on return.
                                if ( filter_has_var( INPUT_GET, 'payload' ) ) {
                                    $payload = filter_input( INPUT_GET, 'payload', FILTER_SANITIZE_STRING );
                        
                        
                        Severity: Minor
                        Found in src/DropInGateway.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 start has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function start( Payment $payment ) {
                                // Amount.
                                $amount = AmountTransformer::transform( $payment->get_total_amount() );
                        
                                // Payment method type.
                        Severity: Major
                        Found in src/WebSdkGateway.php - About 2 hrs to fix

                          Method get_checkout_payment_methods_configuration has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function get_checkout_payment_methods_configuration( $payment_method_types, Payment $payment ) {
                                  $configuration = array();
                          
                                  /*
                                   * Apple Pay.
                          Severity: Major
                          Found in src/DropInGateway.php - About 2 hrs to fix

                            Method __construct has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function __construct( $country, $street = null, $house_number_or_name = null, $postal_code = null, $city = null, $state_or_province = null ) {
                                    /*
                                     * The two-character country code of the address.
                                     *
                                     * The permitted country codes are defined in ISO-3166-1 alpha-2 (e.g. 'NL').
                            Severity: Major
                            Found in src/Address.php - About 2 hrs to fix

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

                                  public function field_certificate( $field ) {
                                      if ( ! \array_key_exists( 'meta_key', $field ) ) {
                                          return;
                                      }
                              
                              
                              Severity: Major
                              Found in src/Integration.php - About 2 hrs to fix

                                BrowserInformation has 21 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class BrowserInformation implements \JsonSerializable {
                                    /**
                                     * The accept header value of the shopper's browser.
                                     *
                                     * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_browserInfo-acceptHeader
                                Severity: Minor
                                Found in src/BrowserInformation.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language