mercadopago/cart-virtuemart

View on GitHub

Showing 38 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

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

              public function post($request, $data = null, $params = null) {
                  if (is_string ($request)) {
                      $request = array(
                          "uri" => $request,
                          "data" => $data,
          Severity: Major
          Found in mercadopago/mercadopago/lib/mercadopago.php and 2 other locations - About 4 hrs to fix
          mercadopago/mercadopago/lib/mercadopago.php on lines 370..387
          mercadopago/mercadopago/lib/mercadopago.php on lines 420..437

          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 167.

          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 3 locations. Consider refactoring.
          Open

              public function put($request, $data = null, $params = null) {
                  if (is_string ($request)) {
                      $request = array(
                          "uri" => $request,
                          "data" => $data,
          Severity: Major
          Found in mercadopago/mercadopago/lib/mercadopago.php and 2 other locations - About 4 hrs to fix
          mercadopago/mercadopago/lib/mercadopago.php on lines 370..387
          mercadopago/mercadopago/lib/mercadopago.php on lines 395..412

          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 167.

          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 3 locations. Consider refactoring.
          Open

              public function get($request, $params = null, $authenticate = true) {
                  if (is_string ($request)) {
                      $request = array(
                          "uri" => $request,
                          "params" => $params,
          Severity: Major
          Found in mercadopago/mercadopago/lib/mercadopago.php and 2 other locations - About 4 hrs to fix
          mercadopago/mercadopago/lib/mercadopago.php on lines 395..412
          mercadopago/mercadopago/lib/mercadopago.php on lines 420..437

          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 167.

          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

                case "custom_credit_card":
                  $(config.basic).parents(".control-group").hide();
                  $(config.custom_ticket).parents(".control-group").hide();
          
                  //show config credic card
          Severity: Major
          Found in mercadopago/mercadopago/assets/js/administrator.js and 1 other location - About 3 hrs to fix
          mercadopago/mercadopago/assets/js/administrator.js on lines 41..48

          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 113.

          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

                case "custom_ticket":
                  $(config.custom_credid_card).parents(".control-group").hide();
                  $(config.basic).parents(".control-group").hide();
          
                  //show config ticket
          Severity: Major
          Found in mercadopago/mercadopago/assets/js/administrator.js and 1 other location - About 3 hrs to fix
          mercadopago/mercadopago/assets/js/administrator.js on lines 33..40

          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 113.

          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

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