File EmailPreferences.php
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use MediaWiki\Extension\CLDR\CountryNames;
use MediaWiki\Extension\CLDR\LanguageNames;
use SmashPig\Core\DataStores\QueueWrapper;
Method paramsForPreferencesForm
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function paramsForPreferencesForm( $checksum, $contact_id ) {
$preferences = CiviproxyConnect::getEmailPreferences( $checksum, $contact_id );
if ( $preferences[ 'is_error' ] ) {
$logger = DonationLoggerFactory::getLoggerFromParams(
Method execute
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $subpage ) {
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
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 setupQueueParams
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function setupQueueParams( $params, $queueName ) {
switch ( $queueName ) {
case 'email-preferences':
$message = [
'checksum' => $params['checksum'],
- 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 paramsForPreferencesForm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function paramsForPreferencesForm( $checksum, $contact_id ) {
$preferences = CiviproxyConnect::getEmailPreferences( $checksum, $contact_id );
if ( $preferences[ 'is_error' ] ) {
$logger = DonationLoggerFactory::getLoggerFromParams(
- 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
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 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"