Showing 275 of 311 total issues
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"
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
Method setAdapterAndValidate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setAdapterAndValidate() {
$this->ensureState();
DonationInterface::setSmashPigProvider( $this->gateway );
Function submit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
di.forms.submit = function () {
var paymentMethod = $( '#payment_method' ).val(),
isIframe = di.forms.isIframe();
if ( !isIframe && paymentMethod !== 'cc' ) {
return oldSubmit();
Function onerror
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.onerror = function ( message, file, line, col, error ) {
var i, postdata;
for ( i = 0; i < ignorePatterns.length; i++ ) {
if ( ignoreRegexes.length <= i ) {
// turn patterns into regexes the first time through
Method handleOptIn
has 26 lines of code (exceeds 25 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;
Method getNoCacheAction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getNoCacheAction() {
$url = $this->gatewayPage->getRequest()->getFullRequestURL();
$url_parts = wfParseUrl( $url );
if ( isset( $url_parts['query'] ) ) {
$query_array = wfCgiToArray( $url_parts['query'] );
Method post_process
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_process() {
// if the trxn has been outright rejected, log it
if ( $this->gateway_adapter->getValidationAction() == ValidationAction::REJECT ) {
$this->log(
$this->gateway_adapter->getData_Unstaged_Escaped( 'contribution_tracking_id' ), 'Rejected'
Method onBeforePageDisplay
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function onBeforePageDisplay( $outputPage, $skin ) {
if ( self::isEndowment() ) {
// FIXME: need to keep generated CSS in sync with
// @see ResourceLoaderSkinModule::getStyles
// html body is prepended to give us more-specific selectors
Method createForGateway
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createForGateway( $gateway, $variant, Config $mwConfig ) {
$extensionBaseDir = $mwConfig->get( 'ExtensionDirectory' ) . DIRECTORY_SEPARATOR
. 'DonationInterface';
/** The following conditional can be deleted when we get rid of WmfFramework */
if ( !is_dir( $extensionBaseDir ) ) {
Method validate
has 26 lines of code (exceeds 25 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
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $subpage ) {
$this->setHeaders();
$this->addStylesScriptsAndViewport();
$params = $this->getRequest()->getValues();
- 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 canBypassMinFraud
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function canBypassMinFraud() {
// if the data bits data_hash and action are not set, we need to hit minFraud
$localdata = $this->gateway_adapter->getData_Unstaged_Escaped();
if ( !isset( $localdata['data_hash'] ) || !strlen(
$localdata['data_hash']
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
protected function handleCreatedPayment(
CreatePaymentResponse $createPaymentResult, PaymentProvider $provider
): PaymentResult {
$transactionStatus = $createPaymentResult->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 getNoCacheAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function getNoCacheAction() {
$url = $this->gatewayPage->getRequest()->getFullRequestURL();
$url_parts = wfParseUrl( $url );
if ( isset( $url_parts['query'] ) ) {
$query_array = wfCgiToArray( $url_parts['query'] );
- 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 tuneForPaymentMethod
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function tuneForPaymentMethod() {
switch ( $this->getPaymentMethod() ) {
case 'dd':
$this->transactions['authorize']['request'] =
array_merge( $this->transactions['authorize']['request'], [
- 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 addArrayElement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected static function addArrayElement( &$targetElement, $structureElement, $key, $value, $callback ) {
if ( is_numeric( $key ) ) {
// it's just a value, not an associative array key
$fieldName = $value;
$fieldValue = $callback( $fieldName );
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function stage( GatewayType $adapter, $normalized, &$stagedData ) {
if ( !isset( $normalized['language'] ) ) {
return;
}
$language = $normalized['language'];
- 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 normalizeOrderID
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function normalizeOrderID( $override = null, $dataObj = null ) {
$selected = false;
$source = null;
$value = null;
if ( $override !== null && $this->validateDataConstraintsMet( 'order_id', $override ) ) {
- 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 value_appears_in
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function value_appears_in( $needle, $haystack ) {
$needle = ( is_array( $needle ) ) ? $needle : [ $needle ];
$haystack = ( is_array( $haystack ) ) ? $haystack : [ $haystack ];
$plusCheck = array_key_exists( '+', $haystack );
- 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"