elisei/pagbank-payment-magento

View on GitHub

Showing 68 of 159 total issues

ConfigCc has 21 functions (exceeds 10 allowed). Consider refactoring.
Open

class ConfigCc extends PaymentConfig
{
    /**
     * @const string
     */
Severity: Minor
Found in Gateway/Config/ConfigCc.php - About 3 hrs to fix

    Config has 21 functions (exceeds 10 allowed). Consider refactoring.
    Open

    class Config extends PaymentConfig
    {
        /**
         * @const string
         */
    Severity: Minor
    Found in Gateway/Config/Config.php - About 3 hrs to fix

      Function handle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(array $handlingSubject, array $response)
          {
              if (!isset($handlingSubject['payment'])
                  || !$handlingSubject['payment'] instanceof PaymentDataObjectInterface
              ) {
      Severity: Minor
      Found in Gateway/Response/FetchPaymentHandler.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

      Oauth has 12 functions (exceeds 10 allowed). Consider refactoring.
      Open

      class Oauth extends Field
      {
          /**
           * Template oAuth.
           */
      Severity: Minor
      Found in Block/Adminhtml/System/Config/Oauth.php - About 2 hrs to fix

        File Config.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * PagBank Payment Magento Module.
         *
         * Copyright © 2023 PagBank. All rights reserved.
        Severity: Minor
        Found in Gateway/Config/Config.php - About 2 hrs to fix

          Function initialize has 56 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

                  initialize() {
                      var self = this,
                          number;
          
                      self._super();
          Severity: Major
          Found in view/frontend/web/js/view/payment/cc-form.js - About 1 hr to fix

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

                    Config $config,
                    Context $context,
                    Json $json,
                    SearchCriteriaBuilder $searchCriteria,
                    TransactionRepositoryInterface $transaction,
            Severity: Major
            Found in Controller/AbstractNotification.php - About 1 hr to fix

              Method getPurchaseItems has 55 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  public function getPurchaseItems(
                      $order
                  ) {
                      $result = [];
                      $items = $order->getItems();
              Severity: Major
              Found in Gateway/Request/ItemsDataRequest.php - About 1 hr to fix

                Function getPagBankPlace has 53 lines of code (exceeds 40 allowed). Consider refactoring.
                Open

                        getPagBankPlace(context, callback, errorCallback) {
                            let encrypted,
                                countPlaceOrder = context.countTryPlaceOrder(),
                                maxTry = context.getMaxTryPlaceOrder(),
                                typePay = context.cardTypeTransaction(),
                Severity: Major
                Found in view/frontend/web/js/view/payment/pagbank-place-order.js - About 1 hr to fix

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

                      public function findForPaymentStatus($response, $charges)
                      {
                          $isPix = isset($response[self::RESPONSE_QR_CODES]);
                          $isTempCancel = false;
                  
                  
                  Severity: Minor
                  Found in Gateway/Response/FetchPaymentHandler.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 setAdditionalInfo has 46 lines of code (exceeds 40 allowed). Consider refactoring.
                  Open

                      public function setAdditionalInfo($payment, $paymentMethod, $cardData)
                      {
                          $ccType = null;
                          $installment = 1;
                  
                  
                  Severity: Minor
                  Found in Gateway/Response/TxnDataCcHandler.php - About 1 hr to fix

                    Function getPreOrderData has 45 lines of code (exceeds 40 allowed). Consider refactoring.
                    Open

                            getPreOrderData(
                                cardPayData
                            ) {
                                var totalAmount = parseFloat(quote.totals()['base_grand_total']) * 100,
                                    customerEmail = quote.guestEmail ? quote.guestEmail : window.checkoutConfig.customerData.email,
                    Severity: Minor
                    Found in view/base/web/js/model/pagbank-pre-order-data.js - About 1 hr to fix

                      Method getPagBankInstallments has 44 lines of code (exceeds 40 allowed). Consider refactoring.
                      Open

                          public function getPagBankInstallments($storeId, $creditCardBin, $amount, $cardTypeTransaction = 'CREDIT_CARD')
                          {
                              /** @var LaminasClient $client */
                              $client = $this->httpClientFactory->create();
                              $url = $this->configBase->getApiUrl($storeId);
                      Severity: Minor
                      Found in Model/Api/ConsultPSInstallments.php - About 1 hr to fix

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

                                TypeListInterface $cacheTypeList,
                                Pool $cacheFrontendPool,
                                Logger $logger,
                                State $state,
                                ScopeConfigInterface $scopeConfig,
                        Severity: Major
                        Found in Model/Console/Command/Basic/Refresh.php - About 1 hr to fix

                          Method execute has 43 lines of code (exceeds 40 allowed). Consider refactoring.
                          Open

                              public function execute()
                              {
                                  $configDefault = false;
                          
                                  $params = $this->getRequest()->getParams();
                          Severity: Minor
                          Found in Controller/Adminhtml/System/Config/Oauth.php - About 1 hr to fix

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

                                public function execute()
                                {
                                    $configDefault = false;
                            
                                    $params = $this->getRequest()->getParams();
                            Severity: Minor
                            Found in Controller/Adminhtml/System/Config/Oauth.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 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function validate(array $validationSubject): ResultInterface
                                {
                                    $response = SubjectReader::readResponse($validationSubject);
                            
                                    $isValid = $response['RESULT_CODE'];
                            Severity: Minor
                            Found in Gateway/Validator/GeneralResponseValidator.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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    Context $context,
                                    TypeListInterface $cacheTypeList,
                                    Pool $cacheFrontendPool,
                                    JsonFactory $resultJsonFactory,
                                    ConfigInterface $configInterface,
                            Severity: Major
                            Found in Controller/Adminhtml/System/Config/Logout.php - About 1 hr to fix

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

                                      CommandPoolInterface $commandPool,
                                      BuilderInterface $requestBuilder,
                                      TransferFactoryInterface $transferFactory,
                                      ClientInterface $client,
                                      LoggerInterface $logger,
                              Severity: Major
                              Found in Gateway/Command/PaymentCommand.php - About 1 hr to fix

                                Function newToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function newToken($storeId = null)
                                    {
                                        $storeIds = $storeId ?: null;
                                        $this->writeln('Init Referesh Token');
                                        $inDefault = $this->getConfigInDefault();
                                Severity: Minor
                                Found in Model/Console/Command/Basic/Refresh.php - About 55 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

                                Severity
                                Category
                                Status
                                Source
                                Language