File GatewayPage.php
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Wikimedia Foundation
*
* LICENSE
Function displayResultsForDebug
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function displayResultsForDebug( ?PaymentTransactionResponse $results = null ) {
$results = !$results ? $this->adapter->getTransactionResponse() : $results;
if ( $this->adapter->getGlobal( 'DisplayDebug' ) !== true ) {
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
Method execute
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
// FIXME: Deprecate "language" param.
$language = $this->getRequest()->getVal( 'language' );
$this->showError = $this->getRequest()->getBool( 'showError' );
GatewayPage
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class GatewayPage extends UnlistedSpecialPage {
/**
* flag for setting Monthly Convert modal on template
* @var bool
*/
Method displayResultsForDebug
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function displayResultsForDebug( ?PaymentTransactionResponse $results = null ) {
$results = !$results ? $this->adapter->getTransactionResponse() : $results;
if ( $this->adapter->getGlobal( 'DisplayDebug' ) !== true ) {
return;
Function setClientVariables
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function setClientVariables( &$vars ) {
$language = $this->adapter->getData_Unstaged_Escaped( 'language' );
$country = $this->adapter->getData_Unstaged_Escaped( 'country' );
$vars['wgDonationInterfaceAmountRules'] = $this->adapter->getDonationRules();
$vars['wgDonationInterfaceLogDebug'] = $this->adapter->getGlobal( 'LogDebug' );
- 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 setClientVariables
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setClientVariables( &$vars ) {
$language = $this->adapter->getData_Unstaged_Escaped( 'language' );
$country = $this->adapter->getData_Unstaged_Escaped( 'country' );
$vars['wgDonationInterfaceAmountRules'] = $this->adapter->getDonationRules();
$vars['wgDonationInterfaceLogDebug'] = $this->adapter->getGlobal( 'LogDebug' );
Method renderResponse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function renderResponse( PaymentResult $result ) {
if ( $result->isFailed() ) {
$this->logger->info( 'Displaying fail page for failed PaymentResult' );
$this->displayFailPage();
return;
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 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
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;