Showing 275 of 311 total issues
Method getParamsFromURL
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getParamsFromURL(): array {
// Get country code from request param, or, if it's not sent or is invalid, use
// geoip lookup
$country = $this->sanitizedValOrNull( 'country' );
Function submitPayment
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function submitPayment() {
if ( !mw.donationInterface.validation.validateAmount() ) {
return;
}
if ( !cardSelected ) {
Method handleCreatedPayment
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleCreatedPayment(
CreatePaymentResponse $createPaymentResult, PaymentProvider $provider
): PaymentResult {
$transactionStatus = $createPaymentResult->getStatus();
Method setupQueueParams
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setupQueueParams( $params, $queueName ) {
switch ( $queueName ) {
case 'email-preferences':
$message = [
'checksum' => $params['checksum'],
Function execute
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $subpage ) {
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
- 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 getLocalizedValidationErrorResult
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function getLocalizedValidationErrorResult( array $validationErrors ): PaymentResult {
$localizedErrors = [];
foreach ( $validationErrors as $error ) {
$field = $error->getField();
$debugMessage = $error->getDebugMessage();
- 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 handleCreatedPayment
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function handleCreatedPayment(
IPaymentProvider $provider, PaymentDetailResponse $authorizeResult
): PaymentResult {
$transactionStatus = $authorizeResult->getStatus();
- 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 getParamsFromURL
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getParamsFromURL(): array {
// Get country code from request param, or, if it's not sent or is invalid, use
// geoip lookup
$country = $this->sanitizedValOrNull( '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 getLocalizedValidationErrorResult
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function getLocalizedValidationErrorResult( array $validationErrors ): PaymentResult {
$localizedErrors = [];
foreach ( $validationErrors as $error ) {
$field = $error->getField();
$debugMessage = $error->getDebugMessage();
- 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 session_resetForNewAttempt
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function session_resetForNewAttempt( $force = false ) {
$reset = $force;
if ( $this->session_getData( 'numAttempt' ) > 3 ) {
$reset = true;
WmfFramework::setSessionValue( 'numAttempt', 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
Method execute
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
// Bow out if gateway chooser is not enabled
if ( !$this->getConfig()->get( 'DonationInterfaceEnableGatewayChooser' ) ) {
throw new BadTitleError();
}
Method session_resetForNewAttempt
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function session_resetForNewAttempt( $force = false ) {
$reset = $force;
if ( $this->session_getData( 'numAttempt' ) > 3 ) {
$reset = true;
WmfFramework::setSessionValue( 'numAttempt', 0 );
Method session_resetOnSwitch
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function session_resetOnSwitch() {
$oldData = $this->session_getData( 'Donor' );
if ( !is_array( $oldData ) ) {
return;
}
Function setup
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setup() {
var component_type,
config,
containerName = 'component-container',
oldShowErrors,
Method handleCreatedPayment
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleCreatedPayment(
IPaymentProvider $provider, PaymentDetailResponse $authorizeResult
): PaymentResult {
$transactionStatus = $authorizeResult->getStatus();
Method getMessageFields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getMessageFields() {
return [
'contribution_tracking_id',
'anonymous',
'utm_source',
Method defineTransactions
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function defineTransactions() {
$this->transactions = [];
// https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
$this->transactions['SetExpressCheckout'] = [
Method getLocalizedValidationErrorResult
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getLocalizedValidationErrorResult( array $validationErrors ): PaymentResult {
$localizedErrors = [];
foreach ( $validationErrors as $error ) {
$field = $error->getField();
$debugMessage = $error->getDebugMessage();
Function createWalletWidget
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createWalletWidget() {
var params = {
sellerId: sellerId,
onReady: function ( billingAgreement ) {
if ( !cardSelected ) {
Function filter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function filter( $filterListGlobal ) {
$functions = $this->gateway_adapter->getGlobal( $filterListGlobal );
if (
!$this->gateway_adapter->getGlobal( 'EnableFunctionsFilter' ) ||
- 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"