wikimedia/mediawiki-extensions-DonationInterface

View on GitHub
adyen_gateway/adyen_submit_payment.api.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public function execute() {
        if ( RequestContext::getMain()->getUser()->pingLimiter( 'submitpayment' ) ) {
            // Allow rate limiting by setting e.g. $wgRateLimits['submitpayment']['ip']
            return;
        }
Severity: Major
Found in adyen_gateway/adyen_submit_payment.api.php - About 3 hrs to fix

    File adyen_submit_payment.api.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    use SmashPig\Core\DataStores\QueueWrapper;
    use SmashPig\Core\SequenceGenerators;
    use SmashPig\Core\UtcDate;
    use SmashPig\PaymentData\FinalStatus;
    Severity: Minor
    Found in adyen_gateway/adyen_submit_payment.api.php - About 2 hrs to fix

      Method sendToDonations has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function sendToDonations() {
              $message = [
                  'contribution_tracking_id' => $this->contributionTrackingId,
                  'date' => UtcDate::getUtcTimestamp(),
                  'gateway' => $this->gateway,
      Severity: Minor
      Found in adyen_gateway/adyen_submit_payment.api.php - About 1 hr to fix

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

            public function execute() {
                if ( RequestContext::getMain()->getUser()->pingLimiter( 'submitpayment' ) ) {
                    // Allow rate limiting by setting e.g. $wgRateLimits['submitpayment']['ip']
                    return;
                }
        Severity: Minor
        Found in adyen_gateway/adyen_submit_payment.api.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

        Method sendToContributionTracking has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function sendToContributionTracking() {
                // build utm key, looks like pay the fee is still taken from that
                if ( $this->donationData['pay_the_fee'] === 1 ) {
                    $this->donationData['utm_key'] = 'ptf_1';
                }
        Severity: Minor
        Found in adyen_gateway/adyen_submit_payment.api.php - About 1 hr to fix

          Avoid too many return statements within this method.
          Open

                          return '';
          Severity: Major
          Found in adyen_gateway/adyen_submit_payment.api.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return;
            Severity: Major
            Found in adyen_gateway/adyen_submit_payment.api.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return;
              Severity: Major
              Found in adyen_gateway/adyen_submit_payment.api.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status