Showing 281 of 300 total issues
File gateway.adapter.php
has 2227 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Wikimedia Foundation
*
GatewayAdapter
has 166 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class GatewayAdapter implements GatewayType {
/**
* Don't change these strings without fixing cross-repo usages.
*/
const REDIRECT_PREFACE = 'Redirecting for transaction: ';
File DonationData.php
has 737 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use SmashPig\Core\DataStores\QueueWrapper;
use SmashPig\Core\SequenceGenerators;
use SmashPig\PaymentData\ReferenceData\CurrencyRates;
use SmashPig\PaymentData\ReferenceData\NationalCurrencies;
Method getFallbacks
has 331 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFallbacks() {
return [
'aae' => 'sq',
'aao' => 'ar',
'aat' => 'sq',
File adyen.js
has 541 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global AdyenCheckout, Promise */
( function ( $, mw ) {
// promise objects are for Apple Pay - see comments below
var checkout, onSubmit, authPromise, submitPromise,
configFromServer = mw.config.get( 'adyenConfiguration' ),
Function setupCardForm
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupCardForm() {
var dlocalInstance = dlocal( mw.config.get( 'wgDlocalSmartFieldApiKey' ) ),
fields = dlocalInstance.fields( {
locale: mapLang( $( '#language' ).val() ),
country: country
Function chooseGatewayByPriority
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function chooseGatewayByPriority( $supportedGateways, $params ) {
$rules = $this->getConfig()->get( 'DonationInterfaceGatewayPriorityRules' );
foreach ( $rules as $rule ) {
// Do our $params match all the conditions for this rule?
- 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 buildOrderIDSources
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function buildOrderIDSources() {
static $built = false;
if ( $built && isset( $this->order_id_candidates ) ) { // once per request is plenty
return;
- 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 Mustache.php
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use LightnCandy\LightnCandy;
use MediaWiki\MediaWikiServices;
use SmashPig\Core\PaymentError;
DonationData
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
class DonationData implements LogPrefixProvider {
protected $normalized = [];
protected $dataSources = [];
protected $gateway;
protected $gatewayID;
File adyen_checkout.adapter.php
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Psr\Log\LogLevel;
use SmashPig\Core\PaymentError;
use SmashPig\Core\ValidationError;
Function validate_personal
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.validate_personal = function () {
var value, countryField, emailAdd, invalid, apos, dotpos, domain,
errorsPresent = false,
$formField,
i,
File DataValidator.php
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use SmashPig\Core\ValidationError;
/**
File GatewayPage.php
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Wikimedia Foundation
*
* LICENSE
Function getComponentConfig
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getComponentConfig( type, checkoutConfig ) {
var config = {};
switch ( type ) {
case 'card':
// Note: Debug messages are only sent and logged server-side if
Method do_transaction_internal
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function do_transaction_internal( $transaction, &$retryVars = null ) {
$this->debugarray[] = __FUNCTION__ . " is doing a $transaction.";
// reset, in case this isn't our first time.
$this->transaction_response = new PaymentTransactionResponse();
Function getSupportedGateways
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private function getSupportedGateways(
string $country,
?string $currency,
string $paymentMethod,
?string $paymentSubmethod,
- 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 IngenicoLocale.php
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Ingenico's connect API returns a 400 BAD REQUEST if the locale string
* doesn't match the xx_YY format. This class tries to find a decent ALPHA2
File dlocal.js
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*global dlocal:true*/
( function ( $, mw ) {
var country = $( '#country' ).val(),
extraData = {},
isRecurring = !!$( '#recurring' ).val(),
File dlocal.adapter.php
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use MediaWiki\MediaWikiServices;
use Psr\Log\LogLevel;
use SmashPig\Core\PaymentError;