hipay/hipay-wallet-cashout-mirakl-library

View on GitHub
src/Vendor/Processor.php

Summary

Maintainability
F
6 days
Test Coverage

File Processor.php has 815 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace HiPay\Wallet\Mirakl\Vendor;

use DateTime;
Severity: Major
Found in src/Vendor/Processor.php - About 1 day to fix

    Method transferFiles has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function transferFiles(array $shopIds, $tmpFilePath)
        {
            if (count($shopIds) > 0) {
                // Fetches all Mirakl file names
                $allMiraklFiles = array();
    Severity: Major
    Found in src/Vendor/Processor.php - About 6 hrs to fix

      Function transferFiles has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public function transferFiles(array $shopIds, $tmpFilePath)
          {
              if (count($shopIds) > 0) {
                  // Fetches all Mirakl file names
                  $allMiraklFiles = array();
      Severity: Minor
      Found in src/Vendor/Processor.php - About 5 hrs 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

      Processor has 33 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Processor extends AbstractApiProcessor
      {
          /** @var VendorManagerInterface */
          protected $vendorManager;
      
      
      Severity: Minor
      Found in src/Vendor/Processor.php - About 4 hrs to fix

        Method registerWallets has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function registerWallets($miraklData)
            {
                $vendorCollection = array();
        
                foreach ($miraklData as $vendorData) {
        Severity: Major
        Found in src/Vendor/Processor.php - About 4 hrs to fix

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

              public function handleBankInfo($vendorCollection, $miraklDataCollection, $tmpFilePath)
              {
                  //Index mirakl Data
                  $miraklDataCollection = $this->indexMiraklData($miraklDataCollection);
          
          
          Severity: Major
          Found in src/Vendor/Processor.php - About 2 hrs to fix

            Function registerWallets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function registerWallets($miraklData)
                {
                    $vendorCollection = array();
            
                    foreach ($miraklData as $vendorData) {
            Severity: Minor
            Found in src/Vendor/Processor.php - About 2 hrs 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 process has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function process($tmpFilesPath, DateTime $lastUpdate = null)
                {
                    try {
                        $this->logger->info('Control Mirakl Settings', array('miraklId' => null, "action" => "Wallet creation"));
            
            
            Severity: Major
            Found in src/Vendor/Processor.php - About 2 hrs to fix

              Function handleBankInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handleBankInfo($vendorCollection, $miraklDataCollection, $tmpFilePath)
                  {
                      //Index mirakl Data
                      $miraklDataCollection = $this->indexMiraklData($miraklDataCollection);
              
              
              Severity: Minor
              Found in src/Vendor/Processor.php - About 2 hrs 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 getFileBack has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getFileBack($fileType, $allMiraklFiles, $frontFile, $shopId, $tmpFilePath)
                  {
              
                      try {
                          $backType = $this->getFileBackType($fileType);
              Severity: Minor
              Found in src/Vendor/Processor.php - About 1 hr to fix

                Method logVendor has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $miraklId,
                        $hipayId,
                        $login,
                        $statusWalletAccount,
                        $status,
                Severity: Major
                Found in src/Vendor/Processor.php - About 1 hr to fix

                  Method createVendor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function createVendor(
                          $email,
                          $walletId,
                          $walletSpaceId,
                          $identified,
                  Severity: Minor
                  Found in src/Vendor/Processor.php - About 1 hr to fix

                    Method createVendor has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            $email,
                            $walletId,
                            $walletSpaceId,
                            $identified,
                            $miraklId,
                    Severity: Major
                    Found in src/Vendor/Processor.php - About 1 hr to fix

                      Function disableVendor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function disableVendor($vendorData)
                          {
                      
                              $vendor = $this->vendorManager->findByMiraklId($vendorData['shop_id']);
                              $logVendor = $this->logVendorManager->findByMiraklId($vendorData['shop_id']);
                      Severity: Minor
                      Found in src/Vendor/Processor.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

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

                              EventDispatcherInterface $dispatcherInterface,
                              LoggerInterface $logger,
                              ApiFactory $factory,
                              VendorManagerInterface $vendorManager,
                              DocumentManagerInterface $documentManager,
                      Severity: Minor
                      Found in src/Vendor/Processor.php - About 45 mins to fix

                        Method getFileBack has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            private function getFileBack($fileType, $allMiraklFiles, $frontFile, $shopId, $tmpFilePath)
                        Severity: Minor
                        Found in src/Vendor/Processor.php - About 35 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                          return $document->getDocumentType() == $theFile['type'] &&
                                                              $document->getMiraklDocumentId() == $theFile['id'];
                          Severity: Major
                          Found in src/Vendor/Processor.php - About 30 mins to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                        if ($boolControl === false) {
                                            // log critical
                                            $title = $this->criticalMessageMiraklSettings;
                                            $message = $this->formatNotification->formatMessage($title);
                                            $this->logger->critical($message, array('miraklId' => null, "action" => "Wallet creation"));
                            Severity: Minor
                            Found in src/Vendor/Processor.php and 1 other location - About 45 mins to fix
                            src/Cashout/Initializer.php on lines 116..126

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 95.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                public function isBankInfoUsable(VendorInterface $vendor, $miraklBankInfo, $checkBankStatus = false)
                                {
                                    if ($checkBankStatus) {
                                        $bankInfoStatus = $this->getBankInfoStatus($vendor);
                            
                            
                            Severity: Minor
                            Found in src/Vendor/Processor.php and 1 other location - About 35 mins to fix
                            src/Vendor/Processor.php on lines 909..925

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 92.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                public function addBankInformation($vendor, $miraklBankInfo, $checkBankStatus = false)
                                {
                                    if ($checkBankStatus) {
                                        $bankInfoStatus = $this->getBankInfoStatus($vendor);
                            
                            
                            Severity: Minor
                            Found in src/Vendor/Processor.php and 1 other location - About 35 mins to fix
                            src/Vendor/Processor.php on lines 883..899

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 92.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            There are no issues that match your filters.

                            Category
                            Status