pagseguro/pagseguro-php-sdk

View on GitHub

Showing 86 of 191 total issues

Function getData has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getData(Requests $request, $properties)
    {
        $data = [];
        if (!is_null($request->getPreApproval())) {
            if (!is_null($request->getPreApproval()->getCharge())) {
Severity: Minor
Found in source/Parsers/PreApproval.php - About 3 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

Function getData has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getData(Requests $request, $properties)
    {
        $data = [];
        $items = $request->getItems();
        if ($request->itemLenght() > 0) {
Severity: Minor
Found in source/Parsers/Item.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 curlConnection has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function curlConnection($method, $url, $timeout, $charset, $data = null)
    {
        if (strtoupper($method) === 'POST') {
            if ($this->contentType === 'Content-Type: application/json;') {
                $postFields = json_encode($data);
Severity: Major
Found in source/Resources/Http.php - About 2 hrs to fix

    PreApproval has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PreApproval
    {
        private $charge;
        private $name;
        private $details;
    Severity: Minor
    Found in source/Domains/PreApproval.php - About 2 hrs to fix

      Function getData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getData(Requests $request, $properties)
          {
              $data = [];
              // sender
              if (!is_null($request->getSender())) {
      Severity: Minor
      Found in source/Parsers/Sender.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 getData has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getData(Requests $request, $properties)
          {
              $data = [];
              if (!is_null($request->getPreApproval())) {
                  if (!is_null($request->getPreApproval()->getCharge())) {
      Severity: Minor
      Found in source/Parsers/PreApproval.php - About 1 hr to fix

        Function curlConnection has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            private function curlConnection($method, $url, $timeout, $charset, $data = null)
            {
                if (strtoupper($method) === 'POST') {
                    if ($this->contentType === 'Content-Type: application/json;') {
                        $postFields = json_encode($data);
        Severity: Minor
        Found in source/Resources/Http.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 getData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getData(Requests $request, $properties)
            {
                $data = [];
        
                if ($request->metadataLenght() > 0) {
        Severity: Minor
        Found in source/Parsers/Metadata.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 getData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getData(Requests $request, $properties)
            {
                $data = [];
                $paymentMethod = $request->getPaymentMethod();
                if ($request->paymentMethodLenght() > 0) {
        Severity: Minor
        Found in source/Parsers/PaymentMethod.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 checkout has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function checkout(Credentials $credentials, \PagSeguro\Domains\Requests\Payment $payment, $onlyCode)
            {
                Logger::info("Begin", ['service' => 'Checkout']);
                try {
                    $connection = new Connection\Data($credentials);
        Severity: Minor
        Found in source/Services/Checkout/Payment.php - About 1 hr to fix

          Method search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function search(
                  Credentials $credentials,
                  array $options
              )
              {
          Severity: Minor
          Found in source/Services/Transactions/Search/Abandoned.php - About 1 hr to fix

            Method search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function search(
                    Credentials $credentials,
                    $reference,
                    array $options
                )
            Severity: Minor
            Found in source/Services/Transactions/Search/Reference.php - About 1 hr to fix

              Method search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function search(
                      Credentials $credentials,
                      array $options
                  )
                  {
              Severity: Minor
              Found in source/Services/Transactions/Search/Date.php - About 1 hr to fix

                Method checkout has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function checkout(
                        Credentials $credentials,
                        \PagSeguro\Domains\Requests\DirectPayment\OnlineDebit $payment
                    )
                    {
                Severity: Minor
                Found in source/Services/DirectPayment/OnlineDebit.php - About 1 hr to fix

                  Method search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function search(
                          Credentials $credentials,
                          array $options
                      ) {
                          try {
                  Severity: Minor
                  Found in source/Services/Application/Search/Date.php - About 1 hr to fix

                    Method search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function search(
                            Credentials $credentials,
                            $reference,
                            array $options
                        ) {
                    Severity: Minor
                    Found in source/Services/Application/Search/Reference.php - About 1 hr to fix

                      Method checkout has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function checkout(
                              Credentials $credentials,
                              \PagSeguro\Domains\Requests\DirectPayment\Boleto $payment
                          )
                          {
                      Severity: Minor
                      Found in source/Services/DirectPayment/Boleto.php - About 1 hr to fix

                        Method edit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function edit(Credentials $credentials, EditPlan $editPlan)
                            {
                                Logger::info("Begin", ['service' => 'DirectPreApproval']);
                                try {
                                    $connection = new Connection\Data($credentials);
                        Severity: Minor
                        Found in source/Services/DirectPreApproval/EditPlanService.php - About 1 hr to fix

                          Method create has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function create(Credentials $credentials, ChangePayment $changePayment)
                              {
                                  Logger::info("Begin", ['service' => 'DirectPreApproval']);
                                  try {
                                      $connection = new Connection\Data($credentials);
                          Severity: Minor
                          Found in source/Services/DirectPreApproval/ChangePaymentService.php - About 1 hr to fix

                            Method search has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function search(Credentials $credentials, $code)
                                {
                                    Logger::info("Begin", ['service' => 'Transactions.Search.Code']);
                            
                                    try {
                            Severity: Minor
                            Found in source/Services/Transactions/Search/Code.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language