hipay/hipay-wallet-cashout-mirakl-library

View on GitHub
src/Notification/Handler.php

Summary

Maintainability
D
2 days
Test Coverage

File Handler.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace HiPay\Wallet\Mirakl\Notification;

use DateTime;
Severity: Minor
Found in src/Notification/Handler.php - About 3 hrs to fix

    Method handleHiPayNotification has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handleHiPayNotification($xml)
        {
            if (!$xml) {
                return;
            }
    Severity: Major
    Found in src/Notification/Handler.php - About 2 hrs to fix

      Method identification has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function identification($hipayId, $date, $status)
          {
              if ($status) {
                  $eventName = 'identification.notification.success';
                  $statusRequest = LogVendorsInterface::SUCCESS;
      Severity: Minor
      Found in src/Notification/Handler.php - About 1 hr to fix

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

            public function handleHiPayNotification($xml)
            {
                if (!$xml) {
                    return;
                }
        Severity: Minor
        Found in src/Notification/Handler.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 bankInfoValidation has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function bankInfoValidation($vendor, $date, $status)
            {
                // if status is OK
                if ($status) {
                    $this->mirakl->updateOneVendor(
        Severity: Minor
        Found in src/Notification/Handler.php - About 1 hr to fix

          Method withdrawalValidation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function withdrawalValidation($hipayId, DateTime $date, $withdrawalId, $status)
              {
                  $operation = $this->operationManager
                      ->findByWithdrawalId($withdrawalId);
          
          
          Severity: Minor
          Found in src/Notification/Handler.php - About 1 hr to fix

            Method transferValidation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function transferValidation($transferId, $status, $notificationType)
                {
                    $operation = $this->operationManager->findOneByTransferId($transferId);
            
                    if (!$operation) {
            Severity: Minor
            Found in src/Notification/Handler.php - About 1 hr to fix

              Method logOperation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function logOperation($miraklId, $paymentVoucherNumber, $status, $message)
                  {
                      $logOperation = $this->logOperationsManager->findByMiraklIdAndPaymentVoucherNumber(
                          $miraklId,
                          $paymentVoucherNumber
              Severity: Minor
              Found in src/Notification/Handler.php - About 1 hr to fix

                Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        EventDispatcherInterface $dispatcher,
                        LoggerInterface $logger,
                        OperationManager $operationManager,
                        VendorManagerInterface $vendorManager,
                        LogVendorsManagerInterface $logVendorManager,
                Severity: Major
                Found in src/Notification/Handler.php - About 50 mins to fix

                  Method other has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $amount,
                          $currency,
                          $label,
                          $hipayId,
                          $date,
                  Severity: Minor
                  Found in src/Notification/Handler.php - About 45 mins to fix

                    Function identification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function identification($hipayId, $date, $status)
                        {
                            if ($status) {
                                $eventName = 'identification.notification.success';
                                $statusRequest = LogVendorsInterface::SUCCESS;
                    Severity: Minor
                    Found in src/Notification/Handler.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