life-code/pagseguro-sdk

View on GitHub

Showing 8 of 22 total issues

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

class PreApproval implements PreApprovalContract
{
    use Validator;
    
    /**
Severity: Minor
Found in src/PreApprovals/Plan/PreApproval.php - About 4 hrs to fix

    File PreApproval.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace PagSeguro\PreApprovals\Plan;
    
    use PagSeguro\Contracts\PreApprovals\Plan\PreApproval as PreApprovalContract;
    Severity: Minor
    Found in src/PreApprovals/Plan/PreApproval.php - About 2 hrs to fix

      Method toArray has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function toArray()
          {
              $response = [
                  'name'             => $this->getName(),
                  'charge'           => $this->getCharge(),
      Severity: Minor
      Found in src/PreApprovals/Plan/PreApproval.php - About 1 hr to fix

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

            public function toArray()
            {
                $response = [
                    'name'             => $this->getName(),
                    'charge'           => $this->getCharge(),
        Severity: Minor
        Found in src/PreApprovals/Plan/PreApproval.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

            public function __construct(string $cep        = null, 
                                        string $street     = null, 
                                        string $number     = null, 
                                        string $complement = null, 
                                        string $district   = null, 
        Severity: Major
        Found in src/Common/Address.php - About 1 hr to fix

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

              private function validateDate(string $date, string $type = 'pt-br') : bool
              {
                  if ($type === 'pt-br') {
                      $date = explode('/', $date);
                  } else if ($type === 'en') {
          Severity: Minor
          Found in src/Support/Validator.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

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

              public function __construct(string $name         = null, 
                                          string $email        = null, 
                                          string $hash         = null, 
                                          string $ip           = null, 
                                          Phone $phone         = null, 
          Severity: Major
          Found in src/Customer/Customer.php - About 50 mins to fix

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

                public function __construct(string $id           = null, 
                                            string $description  = null, 
                                            float $amount        = null, 
                                            int $quantity        = null, 
                                            int $weight          = null, 
            Severity: Minor
            Found in src/Items/Item.php - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language