Showing 275 of 275 total issues
Method getEmployersList
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getEmployersList() {
$employersListDataFile = $this->getConfig()->get( 'DonationInterfaceEmployersListDataFileLocation' );
// Check the employer data file exists
if ( !file_exists( $employersListDataFile ) ) {
$this->setError( 'Employer data file doesn\'t exist: ' . $employersListDataFile );
Method getTransactionSpecificValue
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTransactionSpecificValue( $gateway_field_name ) {
if ( !$this->transactions ) {
$msg = self::getGatewayName() . ': Transactions structure is empty! No transaction can be constructed.';
$this->logger->critical( $msg );
throw new LogicException( $msg );
Method __construct
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $options = [] ) {
$defaults = [
'external_data' => null,
'variant' => null,
];
Method doPayment
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doPayment() {
$this->ensureUniqueOrderID();
$this->session_addDonorData();
$this->setCurrentTransaction( TransactionType::AUTHORIZE );
Gateway_Extras_CustomFilters::onGatewayReady( $this );
Method sendToContributionTracking
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function sendToContributionTracking() {
// build utm key, looks like pay the fee is still taken from that
if ( $this->donationData['pay_the_fee'] === 1 ) {
$this->donationData['utm_key'] = 'ptf_1';
}
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
Method getFieldsToRemove
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFieldsToRemove( ?array $knownData = null ) {
$method = $knownData['payment_method'] ?? $this->getData_Unstaged_Escaped( 'payment_method' );
$submethod = $knownData['payment_submethod'] ?? $this->getData_Unstaged_Escaped( 'payment_submethod' );
if ( $method === 'apple' ) {
// For Apple Pay, do not require any of the following fields in forms,
Method serializeErrors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function serializeErrors( $errors ) {
$serializedErrors = [];
foreach ( $errors as $error ) {
if ( $error instanceof ValidationError ) {
$country = $this->adapter->getData_Unstaged_Escaped( 'country' );
Method normalize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function normalize() {
// FIXME: there's a ghost invocation during DonationData construction.
// This condition should actually be "did data come from anywhere?"
if ( $this->normalized ) {
// Cast all values to string.
Method finalizeInternalStatus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function finalizeInternalStatus( $status ) {
/**
* Handle session stuff!
* -Behavior-
* * Always, always increment numAttempt.
Function validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function validate( array $params, bool $posted ): bool {
if (
empty( $params['checksum'] ) ||
empty( $params['contact_id'] ) ||
!is_numeric( $params['contact_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
Function execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
// Bow out if gateway chooser is not enabled
if ( !$this->getConfig()->get( 'DonationInterfaceEnableGatewayChooser' ) ) {
throw new BadTitleError();
}
- 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 addGatewaySpecificResources
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function addGatewaySpecificResources( OutputPage $out ): void {
if ( $this->isDirectPaymentFlow() ) {
$out->addJsConfigVars( 'isDirectPaymentFlow', true );
if ( $this->isCreditCard() ) {
$dlocalScript = $this->adapter->getAccountConfig( 'dlocalScript' );
- 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 withExtraFields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function withExtraFields( $data, $query ) {
foreach ( self::$extraFieldsMap as $section => $fields ) {
foreach ( $fields as $ourName => $theirName ) {
if ( in_array( $ourName, $this->enabledExtraFields ) ) {
if ( !empty( $data[$ourName] ) ) {
- 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 getByCountry
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getByCountry( $country ) {
if ( isset( self::$list[$country] ) ) {
$divisions = self::$list[$country];
// Localize subdivisions where possible
- 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 healthCheck
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function healthCheck( Score $response ) {
global $wgEmergencyContact;
if ( isset( $response->queriesRemaining ) ) {
$queries = intval( $response->queriesRemaining );
- 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 setNormalizedAmount
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function setNormalizedAmount() {
if ( $this->getVal( 'amount' ) === 'Other' ) {
$this->setVal( 'amount', $this->getVal( 'amountGiven' ) );
}
- 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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
// FIXME: Deprecate "language" param.
$language = $this->getRequest()->getVal( 'language' );
$this->showError = $this->getRequest()->getBool( 'showError' );
- 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 doRecurringConversion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function doRecurringConversion(): PaymentResult {
$sessionData = $this->session_getData( 'Donor' );
if (
empty( $sessionData['recurring_payment_token'] ) ||
empty( $sessionData['gateway_txn_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
Function serializeErrors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function serializeErrors( $errors ) {
$serializedErrors = [];
foreach ( $errors as $error ) {
if ( $error instanceof ValidationError ) {
$country = $this->adapter->getData_Unstaged_Escaped( 'country' );
- 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"