Showing 275 of 311 total issues
Function getAvailableSubmethods
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getAvailableSubmethods() {
$method = $this->getPaymentMethod();
$isRecurring = $this->getData_Unstaged_Escaped( 'recurring' );
$country = $this->getData_Unstaged_Escaped( 'country' );
$methodSupportsRecurring = $method ? $this->getPaymentMethodMeta( $method )['recurring'] : false;
- 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 getTransactionSpecificValue
has a Cognitive Complexity of 9 (exceeds 5 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 );
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate( GatewayType $adapter, $normalized, &$errors ) {
global $wgDonationInterfaceForbiddenCountries;
$hasCountryCode = false;
$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"
Further reading
Function validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate() {
$normalized = $this->dataObj->getData();
if ( $this->transaction_option( 'check_required' ) ) {
// The fields returned by getRequiredFields only make sense
- 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 handleDonationRequest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function handleDonationRequest() {
$this->setHeaders();
// TODO: This is where we should feed GPCS parameters into the gateway
// and DonationData, rather than harvest params in the adapter itself.
- 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 showMonthlyConvert
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function showMonthlyConvert() {
$monthlyConvertAmounts = $this->getMonthlyConvertAmounts();
if ( $monthlyConvertAmounts !== null ) {
$mcMinimumAmount = $monthlyConvertAmounts[0][0];
// check if amount is up to monthly convert minimum amount for specified currency
- 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 filter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function filter() {
$user_ip = $this->gateway_adapter->getData_Unstaged_Escaped( 'user_ip' );
// Determine IP status before doing anything complex
$wl = DataValidator::ip_is_listed( $user_ip, $this->gateway_adapter->getGlobal( 'IPAllowList' ) );
- 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 getSupportedGateways
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $country,
?string $currency,
string $paymentMethod,
?string $paymentSubmethod,
bool $recurring,
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function validate( array $params, $posted ) {
if ( !$this->validateEmail( $params, $posted ) ) {
return false;
}
if ( !$this->validateToken( $params, $posted ) ) {
- 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 validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function validate( GatewayType $adapter, $normalized, &$errors ) {
// validate() is called at various points in the process. We only want to require these
// parameters for card payments, and only during the 'donate' action (not during initial
// form load nor during recurring upgrade). It's a bit odd to find the action in the
// $normalized array, but there it is!
- 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 handleOptIn
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function handleOptIn( &$data ) {
// Since this value can be 1, 0, or unset, we need to make
// special conditionals for the mustache logic
if ( !isset( $data['opt_in'] ) || $data['opt_in'] === '' ) {
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
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function validate( GatewayType $adapter, $normalized, &$errors ) {
global $wgDonationInterfaceDlocalStreetNumberLengthRequirements;
$country = $normalized['country'] ?? '';
$rules = [];
$street_number = $normalized['street_number'] ?? '';
- 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 stage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
if ( !empty( $normalized['return_url'] ) ) {
$returnto = $normalized['return_url'];
} else {
$returnto = '';
- 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 integrateDataFromSession
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function integrateDataFromSession() {
/**
* if the thing coming in from the session isn't already something,
* replace it.
* if it is: assume that the session data was meant to be replaced
- 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 validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function validate( GatewayType $adapter, $normalized, &$errors ) {
global $wgDonationInterfaceDlocalStreetLengthRequirements;
$country = $normalized['country'] ?? '';
$rules = [];
$street_address = $normalized['street_address'] ?? '';
- 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 stage_postal_code
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function stage_postal_code( $normalized ) {
$postalCode = '';
if ( isset( $normalized['postal_code'] ) ) {
$postalCode = trim( $normalized['postal_code'] );
}
- 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 luhn_check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function luhn_check( $str ) {
$odd = ( strlen( $str ) % 2 );
$sum = 0;
$len = strlen( $str );
- 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 validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function validate( GatewayType $adapter, $normalized, &$errors ) {
global $wgDonationInterfaceDlocalPostalCodeLengthRequirements;
$country = $normalized['country'] ?? '';
$rules = [];
$postal_code = $normalized['postal_code'] ?? '';
- 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 onerror
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
window.onerror = function ( message, file, line, col, error ) {
Method addArrayElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected static function addArrayElement( &$targetElement, $structureElement, $key, $value, $callback ) {