mercadopago/cart-zencart

View on GitHub

Showing 16 of 19 total issues

File mercadopago.php has 714 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
include_once "mercadopago/sdk/mercadopago.php";

define("MP_MODULE_VERSION", "1.0.3");
Severity: Major
Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 1 day to fix

    Method _getFieldsConfiguration has 208 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _getFieldsConfiguration()
        {
    
            $configuration_fields = array(
                array(
    Severity: Major
    Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 1 day to fix

      Function build_request has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function build_request($request) {
              if (!extension_loaded ("curl")) {
                  throw new MercadoPagoException("cURL extension not found. You need to enable cURL in your php.ini or another configuration you have.");
              }
      
      
      Severity: Minor
      Found in v.1.5.x/includes/modules/payment/mercadopago/sdk/mercadopago.php - About 4 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 mercadopago.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * MercadoPago Integration Library
       * Access MercadoPago for payments integration
      Severity: Minor
      Found in v.1.5.x/includes/modules/payment/mercadopago/sdk/mercadopago.php - About 4 hrs to fix

        mercadopago has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class mercadopago {
        
            var $code;
            var $title;
            var $description;
        Severity: Minor
        Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 3 hrs to fix

          Method after_process has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function after_process()
              {
          
                  //env global
                  global $insert_id, $order;
          Severity: Major
          Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 2 hrs to fix

            Method _processIPNMerchantOrder has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function _processIPNMerchantOrder(){
                    global $db;
                    require(DIR_WS_CLASSES . 'order.php');
            
                    $mercadopago = new MP(MODULE_PAYMENT_MERCADOPAGO_CLIENT_ID, MODULE_PAYMENT_MERCADOPAGO_CLIENT_SECRET);
            Severity: Major
            Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 2 hrs to fix

              Function _processIPNMerchantOrder has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  function _processIPNMerchantOrder(){
                      global $db;
                      require(DIR_WS_CLASSES . 'order.php');
              
                      $mercadopago = new MP(MODULE_PAYMENT_MERCADOPAGO_CLIENT_ID, MODULE_PAYMENT_MERCADOPAGO_CLIENT_SECRET);
              Severity: Minor
              Found in v.1.5.x/includes/modules/payment/mercadopago.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 build_request has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function build_request($request) {
                      if (!extension_loaded ("curl")) {
                          throw new MercadoPagoException("cURL extension not found. You need to enable cURL in your php.ini or another configuration you have.");
                      }
              
              
              Severity: Major
              Found in v.1.5.x/includes/modules/payment/mercadopago/sdk/mercadopago.php - About 2 hrs to fix

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

                    function update_status()
                    {
                        global $order, $db;
                
                        if (($this->enabled == true) && ((int) MODULE_PAYMENT_MERCADOPAGO_ZONE > 0)) {
                Severity: Minor
                Found in v.1.5.x/includes/modules/payment/mercadopago.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

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

                        function _getSponsorAndSite(){
                            $user_info = array(
                                "site_id" => "MLA",
                                "sponsor_id" => ""
                            );
                Severity: Minor
                Found in v.1.5.x/includes/modules/payment/mercadopago.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 _getSponsorAndSite has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function _getSponsorAndSite(){
                            $user_info = array(
                                "site_id" => "MLA",
                                "sponsor_id" => ""
                            );
                Severity: Minor
                Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 1 hr to fix

                  Function _overOnePaymentsIPN has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                          function _overOnePaymentsIPN($merchant_order){
                              $total_amount = $merchant_order['total_amount'];
                              $total_paid_approved = 0;
                              $payment_return = array(
                                  "status" => "pending",
                  Severity: Minor
                  Found in v.1.5.x/includes/modules/payment/mercadopago.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 _setTextPaymentMethodsExcludeMercadoPago has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                          function _setTextPaymentMethodsExcludeMercadoPago(){
                              global $db;
                  
                              $text_payment_methods = "";
                  
                  Severity: Minor
                  Found in v.1.5.x/includes/modules/payment/mercadopago.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 _checkCredentials has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          function _checkCredentials(){
                              if(MODULE_PAYMENT_MERCADOPAGO_CLIENT_ID == "" || MODULE_PAYMENT_MERCADOPAGO_CLIENT_SECRET == ""){
                                  $this->title .= '<span class="alert"> (Not configured)</span>';
                              }elseif(defined('MODULE_PAYMENT_MERCADOPAGO_CLIENT_ID') && defined('MODULE_PAYMENT_MERCADOPAGO_CLIENT_SECRET')){
                                  $mercadopago = new MP(MODULE_PAYMENT_MERCADOPAGO_CLIENT_ID, MODULE_PAYMENT_MERCADOPAGO_CLIENT_SECRET);
                  Severity: Minor
                  Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 25 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 after_process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function after_process()
                      {
                  
                          //env global
                          global $insert_id, $order;
                  Severity: Minor
                  Found in v.1.5.x/includes/modules/payment/mercadopago.php - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language