mercadopago/cart-virtuemart

View on GitHub

Showing 31 of 38 total issues

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

<?php
/**
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
Severity: Major
Found in mercadopago/mercadopago.php - About 2 days to fix

    File mercadopago_checkout_custom.php has 786 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    defined('_JEXEC') or die('Restricted access');
    
    /**
    Severity: Major
    Found in mercadopago/mercadopago/tmpl/mercadopago_checkout_custom.php - About 1 day to fix

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

      <?php
      /**
       * MercadoPago Integration Library
       * Access MercadoPago for payments integration
       *
      Severity: Minor
      Found in mercadopago/mercadopago/lib/mercadopago.php - About 7 hrs to fix

        Function exec has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function exec($request) {
            // private static function exec($method, $uri, $data, $content_type) {
        
                $connect = self::build_request($request);
        
        
        Severity: Minor
        Found in mercadopago/mercadopago/lib/mercadopago.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

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

            public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
        
                $htmla = array();
                $pm;
        
        
        Severity: Minor
        Found in mercadopago/mercadopago.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

        plgVmPaymentMercadoPago has 38 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class plgVmPaymentMercadoPago extends vmPSPlugin {
        
            private $mercadopago_payment_status;
        
            function __construct(&$subject, $config) {
        Severity: Minor
        Found in mercadopago/mercadopago.php - About 5 hrs to fix

          Function build_request has a Cognitive Complexity of 31 (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 mercadopago/mercadopago/lib/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

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

              function _actionAnalytics($data){
                  $type = "none";
          
                  switch ($data['mercadopago_product_checkout']) {
                      case 'basic_checkout':
          Severity: Minor
          Found in mercadopago/mercadopago.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 paymentNotificationBasic has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              function paymentNotificationBasic($payment_method){
                  $status_http = "HTTP/1.1 200 OK";
          
                  if(isset($_REQUEST['topic']) && isset($_REQUEST['id']) && !is_null($_REQUEST['id'])){
                      if($_REQUEST['topic'] == "merchant_order"){
          Severity: Minor
          Found in mercadopago/mercadopago.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 plgVmDisplayListFEPayment has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
          
                  $htmla = array();
                  $pm;
          
          
          Severity: Major
          Found in mercadopago/mercadopago.php - About 2 hrs to fix

            MP has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class MP {
            
                const version = "0.5.2";
            
                private $client_id;
            Severity: Minor
            Found in mercadopago/mercadopago/lib/mercadopago.php - About 2 hrs to fix

              Function setVariablesMP has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  function setVariablesMP($payment_method){
              
                      $sponsor_id = "";
                      $site_id = "";
                      $mercadopago;
              Severity: Minor
              Found in mercadopago/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 setVariablesMP has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function setVariablesMP($payment_method){
              
                      $sponsor_id = "";
                      $site_id = "";
                      $mercadopago;
              Severity: Major
              Found in mercadopago/mercadopago.php - About 2 hrs to fix

                Method build_request has 62 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 mercadopago/mercadopago/lib/mercadopago.php - About 2 hrs to fix

                  Method _actionAnalytics has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function _actionAnalytics($data){
                          $type = "none";
                  
                          switch ($data['mercadopago_product_checkout']) {
                              case 'basic_checkout':
                  Severity: Major
                  Found in mercadopago/mercadopago.php - About 2 hrs to fix

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

                        function postPreferenceCheckout($cart, $order, $payment_method){
                    
                            $this->logInfo('--------------------------------------', 'debug');
                            $this->logInfo('Create Preference: ' . date("Y-m-d H:i:s"), 'debug');
                            $this->logInfo('Order Data: ' . json_encode($order['details']), 'debug');
                    Severity: Major
                    Found in mercadopago/mercadopago.php - About 2 hrs to fix

                      Method postCreditCardPaymentV1 has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function postCreditCardPaymentV1($cart, $order, $payment_method){
                      
                              // DELETE
                              // require(VMPATH_ROOT . DS.'plugins'.DS.'vmpayment'.DS.'mercadopago'.DS.'mercadopago'.DS.'lib'.DS.'test.php');
                      
                      
                      Severity: Major
                      Found in mercadopago/mercadopago.php - About 2 hrs to fix

                        Method exec has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static function exec($request) {
                            // private static function exec($method, $uri, $data, $content_type) {
                        
                                $connect = self::build_request($request);
                        
                        
                        Severity: Major
                        Found in mercadopago/mercadopago/lib/mercadopago.php - About 2 hrs to fix

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

                              function __construct(&$subject, $config) {
                          
                                  parent::__construct($subject, $config);
                          
                                  $this->_loggable = TRUE;
                          Severity: Minor
                          Found in mercadopago/mercadopago.php - About 1 hr to fix

                            Function updateStatusOrder has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                function updateStatusOrder($payment_method, $order_id, $status, $payment){
                                    $status_http = "HTTP/1.1 200 OK";
                            
                                    $orderModel=VmModel::getModel('orders');
                                    $order = $orderModel->getOrder($order_id);
                            Severity: Minor
                            Found in mercadopago/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

                            Severity
                            Category
                            Status
                            Source
                            Language