wp-pay-gateways/adyen

View on GitHub

Showing 50 of 50 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

              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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        onError: ( error ) => {
                            if ( 'CANCEL' === error.name ) {
                                return;
                            }
                
                
                Severity: Major
                Found in js/src/checkout-drop-in.js and 1 other location - About 2 hrs to fix
                js/dist/checkout-drop-in.js on lines 38..47

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 90.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            onError: function onError(error) {
                              if ('CANCEL' === error.name) {
                                return;
                              }
                
                
                Severity: Major
                Found in js/dist/checkout-drop-in.js and 1 other location - About 2 hrs to fix
                js/src/checkout-drop-in.js on lines 27..38

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 90.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                <?php
                /**
                 * Gateway
                 *
                 * @author    Pronamic <info@pronamic.eu>
                Severity: Minor
                Found in src/Gateway.php - About 2 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

                        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

                          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

                            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
                                Severity
                                Category
                                Status
                                Source
                                Language