PromisePay/promisepay-php

View on GitHub
lib/UserRepository.php

Summary

Maintainability
D
2 days
Test Coverage

File UserRepository.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace PromisePay;

use PromisePay\DataObjects\BankAccount;
use PromisePay\DataObjects\CardAccount;
Severity: Minor
Found in lib/UserRepository.php - About 3 hrs to fix

    Method isCorrectCountryCode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function isCorrectCountryCode($Country)
        {
            $allowedCountryCode = array(
                "AFG", "ALA", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATA",
                "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHS", "BHR",
    Severity: Minor
    Found in lib/UserRepository.php - About 1 hr to fix

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

          public function createUser(User $user)
          {
              $this->validateUser($user);
              $payload = '';
              $preparePayload = array(
      Severity: Minor
      Found in lib/UserRepository.php - About 1 hr to fix

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

            public function updateUser(User $user)
            {
                $this->validateUser($user);
        
                $payload = '';
        Severity: Minor
        Found in lib/UserRepository.php - About 1 hr to fix

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

              public function getListOfPayPalAccountsForUser($id)
              {
                  $this->checkIdNotNull($id);
                  $response = $this->RestClient('get', 'users/'.$id.'/paypal_accounts');
                  $jsonData =  $jsonData = json_decode($response->raw_body, true);
          Severity: Major
          Found in lib/UserRepository.php and 1 other location - About 2 hrs to fix
          lib/UserRepository.php on lines 169..185

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

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

              public function getListOfBankAccountsForUser($id)
              {
                  $this->checkIdNotNull($id);
                  $response = $this->RestClient('get', 'users/'.$id.'/bank_accounts');
                  $jsonData =  $jsonData = json_decode($response->raw_body, true);
          Severity: Major
          Found in lib/UserRepository.php and 1 other location - About 2 hrs to fix
          lib/UserRepository.php on lines 148..167

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

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

              public function getListOfUsers($limit = 20, $offset = 0)
              {
                  $this->paramsListCorrect($limit,$offset);
                  $response = $this->RestClient('get', 'users?limit=' . $limit . '&offset=' . $offset, '', '');
                  $allUsers = array();
          Severity: Major
          Found in lib/UserRepository.php and 3 other locations - About 2 hrs to fix
          lib/CompanyRepository.php on lines 10..22
          lib/FeeRepository.php on lines 12..24
          lib/UploadRepository.php on lines 11..23

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

          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

                  $preparePayload = array(
                          "id"            => $user->getId(),
                          "first_name"    => $user->getFirstName(),
                          "last_name"     => $user->getLastName(),
                          "email"         => $user->getEmail(),
          Severity: Minor
          Found in lib/UserRepository.php and 1 other location - About 45 mins to fix
          lib/UserRepository.php on lines 222..234

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

          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

                  $preparePayload = array(
                      "id"            => $user->getId(),
                      "first_name"    => $user->getFirstName(),
                      "last_name"     => $user->getLastName(),
                      "email"         => $user->getEmail(),
          Severity: Minor
          Found in lib/UserRepository.php and 1 other location - About 45 mins to fix
          lib/UserRepository.php on lines 52..64

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

          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