Showing 302 of 302 total issues
Avoid too many return
statements within this method. Open
return $employerList;
Function setupOptIn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setupOptIn( $params ) {
$message = [
'email' => $params['email'],
];
if ( !empty( $params['variant'] ) ) {
- 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 validateEmail
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function validateEmail( array $params, $posted ) {
if ( empty( $params['email'] ) ) {
// When we post back, we need an email
if ( $posted ) {
return 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 validateToken
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function validateToken( array $params, $posted ) {
if ( empty( $params['token'] ) ) {
if ( $posted ) {
return 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 validateToken
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function validateToken( array $params, $posted ) {
if ( empty( $params['token'] ) ) {
if ( $posted ) {
return 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 setAmountLabelKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function setAmountLabelKey( &$data ): void {
if ( $data['recurring'] ) {
$isAnnual = ( isset( $data['frequency_unit'] ) && $data['frequency_unit'] == 'year' );
if ( $isAnnual ) {
$key = 'donate_interface-annual-amount';
- 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 addRetryLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function addRetryLink( &$data ) {
$params = [];
if ( !$this->gateway->session_hasDonorData() ) {
foreach ( DonationData::getRetryFields() as $field ) {
if ( isset( $data[$field] ) ) {
- 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 determineAction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function determineAction() {
$risk_score = $this->getRiskScore();
// possible risk scores are between 0 and 100
if ( $risk_score < 0 ) {
$risk_score = 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
Function getRiskScore
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getRiskScore( $scoreArray = null ) {
if ( $scoreArray === null ) {
$scoreArray = $this->risk_score;
}
- 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 addDonorDetailsToSession
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function addDonorDetailsToSession( PaymentDetailResponse $detailResponse ): void {
$donorDetails = $detailResponse->getDonorDetails();
if ( $donorDetails !== null ) {
$responseData = [
'first_name' => $donorDetails->getFirstName(),
- 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 setClientVariables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setClientVariables( &$vars ): void {
parent::setClientVariables( $vars );
$vars['dlocalScript'] = $this->adapter->getAccountConfig( 'dlocalScript' );
$vars['DonationInterfaceThankYouPage'] = ResultPages::getThankYouPage( $this->adapter );
$supportedSubmethods = array_keys( $this->adapter->getAvailableSubmethods() );
- 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 getScoreUtmMediumMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getScoreUtmMediumMap() {
$score = 0;
$medium = $this->getData_Unstaged_Escaped( 'utm_medium' );
$mediumMap = $this->getGlobal( 'UtmMediumMap' );
- 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 normalize
has a Cognitive Complexity of 6 (exceeds 5 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.
- 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 getErrorMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getErrorMap( $code, $options = [] ) {
$defaults = [
'translate' => false,
];
$options = array_merge( $defaults, $options );
- 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 getScoreUtmCampaignMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getScoreUtmCampaignMap() {
$score = 0;
$campaign = $this->getData_Unstaged_Escaped( 'utm_campaign' );
$campaignMap = $this->getGlobal( 'UtmCampaignMap' );
- 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 renderResponse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function renderResponse( PaymentResult $result ) {
if ( $result->isFailed() ) {
$this->logger->info( 'Displaying fail page for failed PaymentResult' );
$this->displayFailPage();
} elseif ( $url = $result->getRedirect() ) {
- 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 getPaymentSubmethodMeta
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getPaymentSubmethodMeta( $payment_submethod = null, $payment_method = null ) {
if ( $payment_submethod === null ) {
$payment_submethod = $this->getPaymentSubmethod();
}
- 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 getEmployersList
has a Cognitive Complexity of 6 (exceeds 5 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 );
- 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 getScoreUtmSourceMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getScoreUtmSourceMap() {
$score = 0;
$source = $this->getData_Unstaged_Escaped( 'utm_source' );
$sourceMap = $this->getGlobal( 'UtmSourceMap' );
- 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 ensureState
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function ensureState() {
if ( !$this->donationData ) {
$this->donationData = $this->extractRequestParams();
}
- 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"