life-code/pagseguro-sdk

View on GitHub

Showing 13 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

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

    <?php
    
    namespace PagSeguro\Http\Transactions\Abandoned;
    
    use PagSeguro\Http\Response as BaseResponse;
    Severity: Major
    Found in src/Http/Transactions/Abandoned/Response.php and 1 other location - About 4 hrs to fix
    src/Http/Transactions/Notifications/Response.php on lines 1..59

    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 162.

    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

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

    <?php
    
    namespace PagSeguro\Http\Transactions\Notifications;
    
    use PagSeguro\Http\Response as BaseResponse;
    Severity: Major
    Found in src/Http/Transactions/Notifications/Response.php and 1 other location - About 4 hrs to fix
    src/Http/Transactions/Abandoned/Response.php on lines 1..59

    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 162.

    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

    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

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

        <?php
        
        namespace PagSeguro\Transactions;
        
        use PagSeguro\Contracts\Credentials\AccountCredentials;
        Severity: Major
        Found in src/Transactions/Notification.php and 2 other locations - About 1 hr to fix
        src/PreApprovals/Cancelation.php on lines 1..57
        src/PreApprovals/Notification.php on lines 1..57

        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 101.

        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 3 locations. Consider refactoring.
        Open

        <?php
        
        namespace PagSeguro\PreApprovals;
        
        use PagSeguro\Contracts\Credentials\AccountCredentials;
        Severity: Major
        Found in src/PreApprovals/Cancelation.php and 2 other locations - About 1 hr to fix
        src/PreApprovals/Notification.php on lines 1..57
        src/Transactions/Notification.php on lines 1..57

        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 101.

        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 3 locations. Consider refactoring.
        Open

        <?php
        
        namespace PagSeguro\PreApprovals;
        
        use PagSeguro\Contracts\Credentials\AccountCredentials;
        Severity: Major
        Found in src/PreApprovals/Notification.php and 2 other locations - About 1 hr to fix
        src/PreApprovals/Cancelation.php on lines 1..57
        src/Transactions/Notification.php on lines 1..57

        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 101.

        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

        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