wikimedia/mediawiki-extensions-DonationInterface

View on GitHub
special/EmailPreferences.php

Summary

Maintainability
C
1 day
Test Coverage

Method paramsForPreferencesForm has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function paramsForPreferencesForm( $checksum, $contact_id ) {
        $prefs = CiviproxyConnect::getEmailPreferences( $checksum, $contact_id );

        if ( $prefs[ 'is_error' ] ) {
            $logger = DonationLoggerFactory::getLoggerFromParams(
Severity: Major
Found in special/EmailPreferences.php - About 2 hrs to fix

    File EmailPreferences.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    use SmashPig\Core\DataStores\QueueWrapper;
    
    class EmailPreferences extends UnlistedSpecialPage {
    Severity: Minor
    Found in special/EmailPreferences.php - About 2 hrs to fix

      Method execute has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function execute( $subpage ) {
              $this->setHeaders();
              $this->outputHeader();
              $out = $this->getOutput();
      
      
      Severity: Minor
      Found in special/EmailPreferences.php - About 1 hr to fix

        Function execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute( $subpage ) {
                $this->setHeaders();
                $this->outputHeader();
                $out = $this->getOutput();
        
        
        Severity: Minor
        Found in special/EmailPreferences.php - About 1 hr to fix

        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 ) {
                $prefs = CiviproxyConnect::getEmailPreferences( $checksum, $contact_id );
        
                if ( $prefs[ 'is_error' ] ) {
                    $logger = DonationLoggerFactory::getLoggerFromParams(
        Severity: Minor
        Found in special/EmailPreferences.php - About 1 hr to fix

        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 ) ) {
        Severity: Minor
        Found in special/EmailPreferences.php - About 45 mins to fix

        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;
                    }
        Severity: Minor
        Found in special/EmailPreferences.php - About 25 mins to fix

        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;
        Severity: Minor
        Found in special/EmailPreferences.php - About 25 mins to fix

        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 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'] ) ) {
        Severity: Minor
        Found in special/EmailPreferences.php - About 25 mins to fix

        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

        There are no issues that match your filters.

        Category
        Status