pagseguro/pagseguro-php-sdk

View on GitHub
source/Services/Authorization/PersonalService.php

Summary

Maintainability
F
3 days
Test Coverage

Method makeAddressNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function makeAddressNode(\DOMNode $personDom)
    {
        $addressElement = $this->dom->createElement('address');
        $addressDom = $personDom->appendChild($addressElement);

Severity: Minor
Found in source/Services/Authorization/PersonalService.php - About 1 hr to fix

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

        private function makeAddressNode(\DOMNode $personDom)
        {
            $addressElement = $this->dom->createElement('address');
            $addressDom = $personDom->appendChild($addressElement);
    
    
    Severity: Major
    Found in source/Services/Authorization/PersonalService.php and 2 other locations - About 1 day to fix
    source/Services/Authorization/CompanyService.php on lines 263..299
    source/Services/Authorization/SellerService.php on lines 189..225

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

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

        private function makeAuthorizationNode()
        {
            $authorizationRequestElement = $this->dom->createElement('authorizationRequest');
            $authorizationRequestDom = $this->dom->appendChild($authorizationRequestElement);
    
    
    Severity: Major
    Found in source/Services/Authorization/PersonalService.php and 2 other locations - About 1 day to fix
    source/Services/Authorization/CompanyService.php on lines 70..99
    source/Services/Authorization/SellerService.php on lines 68..97

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

    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

        private function makePhonesNode(\DOMNode $personDom)
        {
            $phonesElement = $this->dom->createElement('phones');
            $phonesDom = $personDom->appendChild($phonesElement);
            $phones = $this->authorization->getAccount()->getPersonal()->getPhones();
    Severity: Major
    Found in source/Services/Authorization/PersonalService.php and 2 other locations - About 4 hrs to fix
    source/Services/Authorization/CompanyService.php on lines 212..234
    source/Services/Authorization/SellerService.php on lines 138..160

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

    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

        private function makePersonNode(\DOMNode $accountDom)
        {
            $personElement = $this->dom->createElement('person');
            $personDom = $accountDom->appendChild($personElement);
    
    
    Severity: Major
    Found in source/Services/Authorization/PersonalService.php and 2 other locations - About 1 hr to fix
    source/Services/Authorization/CompanyService.php on lines 122..136
    source/Services/Authorization/SellerService.php on lines 120..133

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

    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

        public function __construct(Authorization $authorization)
        {
            $this->authorization = $authorization;
            $this->dom = new \DOMDocument('1.0', 'UTF-8');
            $this->dom->xmlStandalone = true;
    Severity: Major
    Found in source/Services/Authorization/PersonalService.php and 1 other location - About 1 hr to fix
    source/Services/Authorization/SellerService.php on lines 52..63

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

    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

    There are no issues that match your filters.

    Category
    Status