pagseguro/magento2

View on GitHub
Helper/Data.php

Summary

Maintainability
F
5 days
Test Coverage

File Data.php has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * 2007-2016 [PagSeguro Internet Ltda.]
 *
 * NOTICE OF LICENSE
Severity: Minor
Found in Helper/Data.php - About 4 hrs to fix

    Function getTitleCodePaymentMethod has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getTitleCodePaymentMethod($code)
        {
            if (!is_null($code)) {
                switch ($code) {
                    case 101:
    Severity: Minor
    Found in Helper/Data.php - About 4 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 getTitleCodePaymentMethod has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getTitleCodePaymentMethod($code)
        {
            if (!is_null($code)) {
                switch ($code) {
                    case 101:
    Severity: Major
    Found in Helper/Data.php - About 3 hrs to fix

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

          public static function getTransactionTypeName($transactionTypeCode)
          {
              if ($transactionTypeCode) {
                  switch ($transactionTypeCode) {
                      case 1:
      Severity: Minor
      Found in Helper/Data.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 getTransactionTypeName has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getTransactionTypeName($transactionTypeCode)
          {
              if ($transactionTypeCode) {
                  switch ($transactionTypeCode) {
                      case 1:
      Severity: Minor
      Found in Helper/Data.php - About 1 hr to fix

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

            public static function getPaymentStatusToString($key)
            {
        
                if (array_key_exists($key, self::$statusList)) {
                    switch ($key) {
        Severity: Minor
        Found in Helper/Data.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 getPaymentStatusToString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getPaymentStatusToString($key)
            {
        
                if (array_key_exists($key, self::$statusList)) {
                    switch ($key) {
        Severity: Minor
        Found in Helper/Data.php - About 1 hr to fix

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

              private static function sortData($text)
              {
                  if (preg_match('/[-,\\n]/', $text)) {
                      $broken = preg_split('/[-,\\n]/', $text);
                      for ($i = 0; $i < strlen($broken[0]); $i++) {
          Severity: Minor
          Found in Helper/Data.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

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

              public static function getTitleTypePaymentMethod($type)
              {
                  if (!is_null($type)) {
                      switch ($type) {
                          case 1:
          Severity: Minor
          Found in Helper/Data.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

          Avoid too many return statements within this method.
          Open

                              return 'Cartão de crédito Cabal';
          Severity: Major
          Found in Helper/Data.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return 'Boleto Santander';
            Severity: Major
            Found in Helper/Data.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return 'Saldo PagSeguro';
              Severity: Major
              Found in Helper/Data.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return 'Cobrança';
                Severity: Major
                Found in Helper/Data.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return 'Operacional';
                  Severity: Major
                  Found in Helper/Data.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return 'Cartão de crédito PersonalCard';
                    Severity: Major
                    Found in Helper/Data.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return $type;
                      Severity: Major
                      Found in Helper/Data.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return 'Cartão de crédito Hipercard';
                        Severity: Major
                        Found in Helper/Data.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return 'Débito online Itaú';
                          Severity: Major
                          Found in Helper/Data.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return 'Chargeback Debitado';
                            Severity: Major
                            Found in Helper/Data.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  return 'Secundária';
                              Severity: Major
                              Found in Helper/Data.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                    return 'Depósito em conta';
                                Severity: Major
                                Found in Helper/Data.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return 'Cartão de crédito Mais!';
                                  Severity: Major
                                  Found in Helper/Data.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return 'Débito online Banco do Brasil';
                                    Severity: Major
                                    Found in Helper/Data.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return false;
                                      Severity: Major
                                      Found in Helper/Data.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                            return 'Cartão de crédito GRANDCARD';
                                        Severity: Major
                                        Found in Helper/Data.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                              return 'Débito online Banrisul';
                                          Severity: Major
                                          Found in Helper/Data.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                return 'Dispon&iacute;vel';
                                            Severity: Major
                                            Found in Helper/Data.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                      return false;
                                              Severity: Major
                                              Found in Helper/Data.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                    return 'Cartão de crédito BrasilCard';
                                                Severity: Major
                                                Found in Helper/Data.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                      return 'Cartão de crédito FORTBRASIL';
                                                  Severity: Major
                                                  Found in Helper/Data.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                        return 'Depósito em conta - Banco do Brasil';
                                                    Severity: Major
                                                    Found in Helper/Data.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                          return 'Bônus';
                                                      Severity: Major
                                                      Found in Helper/Data.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                            return 'Doação';
                                                        Severity: Major
                                                        Found in Helper/Data.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                              return 'Cartão de crédito Aura';
                                                          Severity: Major
                                                          Found in Helper/Data.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                                return 'Cartão de crédito Elo';
                                                            Severity: Major
                                                            Found in Helper/Data.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                                  return 'Cartão de crédito Sorocred';
                                                              Severity: Major
                                                              Found in Helper/Data.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        return false;
                                                                Severity: Major
                                                                Found in Helper/Data.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                      return 'Cartão de crédito VALECARD';
                                                                  Severity: Major
                                                                  Found in Helper/Data.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                        return 'Cartão de crédito Up Policard';
                                                                    Severity: Major
                                                                    Found in Helper/Data.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                          return 'Boleto Bradesco';
                                                                      Severity: Major
                                                                      Found in Helper/Data.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                            return $code;
                                                                        Severity: Major
                                                                        Found in Helper/Data.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                              return 'Cancelada';
                                                                          Severity: Major
                                                                          Found in Helper/Data.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                                return 'Devolvida';
                                                                            Severity: Major
                                                                            Found in Helper/Data.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                  return 'Doação pública';
                                                                              Severity: Major
                                                                              Found in Helper/Data.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                    return 'Pagamento pré aprovado';
                                                                                Severity: Major
                                                                                Found in Helper/Data.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                      return 'Validador';
                                                                                  Severity: Major
                                                                                  Found in Helper/Data.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                        return 'Em disputa';
                                                                                    Severity: Major
                                                                                    Found in Helper/Data.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                          return 'Em Contestação';
                                                                                      Severity: Major
                                                                                      Found in Helper/Data.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                            return 'Cartão de crédito Banese Card';
                                                                                        Severity: Major
                                                                                        Found in Helper/Data.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                              return 'Débito online Bradesco';
                                                                                          Severity: Major
                                                                                          Found in Helper/Data.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                                return 'Campanha bônus';
                                                                                            Severity: Major
                                                                                            Found in Helper/Data.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                                  return $transactionTypeCode;
                                                                                              Severity: Major
                                                                                              Found in Helper/Data.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                    return 'Repasse de bônus';
                                                                                                Severity: Major
                                                                                                Found in Helper/Data.php - About 30 mins to fix

                                                                                                  There are no issues that match your filters.

                                                                                                  Category
                                                                                                  Status