wp-pay-gateways/adyen

View on GitHub

Showing 48 of 52 total issues

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

    public function get_settings_fields() {
        $fields = [];

        // Merchant Account.
        $fields[] = [
Severity: Major
Found in src/Integration.php - About 5 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

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

          public static function complement( Payment $payment, AbstractPaymentRequest $request, Config $config ) {
              /**
               * Merchant order reference.
               *
               * @link https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/payments__reqParam_merchantOrderReference
      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

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

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

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

            public static function complement( Payment $payment, AbstractPaymentRequest $request, Config $config ) {
                /**
                 * Merchant order reference.
                 *
                 * @link https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/payments__reqParam_merchantOrderReference
        Severity: Major
        Found in src/PaymentRequestHelper.php - About 4 hrs to fix

          Method payment_redirect has 103 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/Gateway.php - About 4 hrs to fix

            Method rest_api_init has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function rest_api_init() {
                    /**
                     * Adyen return route.
                     * 
                     * @link https://docs.adyen.com/online-payments/web-drop-in#handle-redirect-result
            Severity: Major
            Found in src/ReturnController.php - About 3 hrs to fix

              File Gateway.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

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

                    public function rest_api_adyen_notifications( WP_REST_Request $request ) {
                        $json = $request->get_body();
                
                        $data = json_decode( $json );
                
                
                Severity: Minor
                Found in src/NotificationsController.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 get_http_authorization_test has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method rest_api_adyen_return has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function rest_api_adyen_return( WP_REST_Request $request ) {
                          $payment_id = $request->get_param( 'payment_id' );
                  
                          // Payment ID.
                          if ( null === $payment_id ) {
                  Severity: Major
                  Found in src/ReturnController.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 maybe_display_migrate_client_key_admin_notice has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function maybe_display_migrate_client_key_admin_notice() {
                              if ( ! \current_user_can( 'manage_options' ) ) {
                                  return;
                              }
                      
                      
                      Severity: Major
                      Found in src/Integration.php - About 2 hrs to fix

                        File ReturnController.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

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

                              public function rest_api_adyen_notifications( WP_REST_Request $request ) {
                                  $json = $request->get_body();
                          
                                  $data = json_decode( $json );
                          
                          
                          Severity: Major
                          Found in src/NotificationsController.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

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

                              _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
                                var configuration, checkout, dropinComponent;
                                return regeneratorRuntime.wrap(function _callee$(_context) {
                                  while (1) {
                                    switch (_context.prev = _context.next) {
                              Severity: Minor
                              Found in js/dist/checkout-drop-in.js - 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 start has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function start( Payment $payment ) {
                                      $payment->set_meta( 'adyen_sdk_version', self::SDK_VERSION );
                                      $payment->set_action_url( $payment->get_pay_redirect_url() );
                              
                                      // API only.
                              Severity: Minor
                              Found in src/Gateway.php - About 1 hr to fix

                                Method rest_api_adyen_error has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function rest_api_adyen_error( WP_REST_Request $request ) {
                                        $payment_id = $request->get_param( 'payment_id' );
                                
                                        // Payment ID.
                                        if ( null === $payment_id ) {
                                Severity: Minor
                                Found in src/ReturnController.php - About 1 hr to fix

                                  Function __construct has a Cognitive Complexity of 13 (exceeds 5 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: 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language