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");
Method _getFieldsConfiguration
has 208 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _getFieldsConfiguration()
{
$configuration_fields = array(
array(
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.");
}
- Read upRead up
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
mercadopago
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class mercadopago {
var $code;
var $title;
var $description;
Method after_process
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function after_process()
{
//env global
global $insert_id, $order;
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);
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);
- Read upRead up
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.");
}
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)) {
- Read upRead up
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" => ""
);
- Read upRead up
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" => ""
);
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",
- Read upRead up
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 = "";
- Read upRead up
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);
- Read upRead up
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;
- Read upRead up
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"