PromisePay/promisepay-php

View on GitHub

Showing 72 of 72 total issues

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

    public function acknowledgePayPal($itemId)
    {
        $this->checkIdNotNull($itemId);

        $response = $this->RestClient('patch', 'items/' . $itemId . '/acknowledge_paypal');
Severity: Major
Found in lib/ItemRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function startImport($uploadId)
    {
        $this->checkIdNotNull($uploadId);

        $response = $this->RestClient('patch', 'uploads/'.$uploadId.'/import');
Severity: Major
Found in lib/UploadRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68

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

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

    public function getUserForBankAccount($id)
    {
        $this->checkIdNotNull($id);
        $response = $this->RestClient('get','bank_accounts/'.$id.'/users');
        $jsonRaw = json_decode($response->raw_body, true);
Severity: Major
Found in lib/BankAccountRepository.php and 13 other locations - About 1 hr to fix
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function getBPayDetailsForItem($id)
    {
        $this->checkIdNotNull($id);
        $response = $this->RestClient('get', 'items/' . $id . '/bpay_details');
        $jsonRaw = json_decode($response->raw_body, true);
Severity: Major
Found in lib/ItemRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function getBuyerOfItem($id)
    {
        $this->checkIdNotNull($id);
        $response = $this->RestClient('get', 'items/' . $id . '/buyers');
        $jsonRaw = json_decode($response->raw_body, true);
Severity: Major
Found in lib/ItemRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function getUserForPayPalAccount($id)
    {
        $this->checkIdNotNull($id);
        $response = $this->RestClient('get','/paypal_accounts/'.$id.'/users');
        $jsonRaw = json_decode($response->raw_body, true);
Severity: Major
Found in lib/PayPalAccountRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function getSellerForItem($id)
    {
        $this->checkIdNotNull($id);
        $response = $this->RestClient('get', 'items/' . $id . '/sellers');
        $jsonRaw = json_decode($response->raw_body, true);
Severity: Major
Found in lib/ItemRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function cancelItem($itemId)
    {
        $this->checkIdNotNull($itemId);
        $response = $this->RestClient('patch', 'items/' . $itemId . '/cancel');
        $jsonRaw = json_decode($response->raw_body, true);
Severity: Major
Found in lib/ItemRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function acknowledgeWire($itemId)
    {
        $this->checkIdNotNull($itemId);

        $response = $this->RestClient('patch', 'items/' . $itemId . '/acknowledge_wire');
Severity: Major
Found in lib/ItemRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 55..68
lib/UploadRepository.php on lines 70..84

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

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

    public function getStatus($uploadId)
    {
        $this->checkIdNotNull($uploadId);
        $response = $this->RestClient('get', '/uploads/'.$uploadId.'/import');

Severity: Major
Found in lib/UploadRepository.php and 13 other locations - About 1 hr to fix
lib/BankAccountRepository.php on lines 63..75
lib/CardAccountRepository.php on lines 58..70
lib/ItemRepository.php on lines 150..162
lib/ItemRepository.php on lines 182..194
lib/ItemRepository.php on lines 196..208
lib/ItemRepository.php on lines 210..222
lib/ItemRepository.php on lines 224..236
lib/ItemRepository.php on lines 266..279
lib/ItemRepository.php on lines 339..351
lib/ItemRepository.php on lines 353..366
lib/ItemRepository.php on lines 368..381
lib/PayPalAccountRepository.php on lines 49..61
lib/UploadRepository.php on lines 70..84

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

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

        Method updateItem has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function updateItem(Item $item, $user = null, $account = null, $releaseAmount = null)
            {
                $payload = '';
                $preparePayload = array(
                   'id'=>$item->getId(),
        Severity: Minor
        Found in lib/ItemRepository.php - About 1 hr to fix

          Method createFee has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function createFee(Fee $fee)
              {
                  $this->ValidateFee($fee);
                  $payload = '';
                  $preparePayload = array(
          Severity: Minor
          Found in lib/FeeRepository.php - About 1 hr to fix

            Method createItem has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createItem(Item $item)
                {
                    $payload = '';
                    $preparePayload = array(
                        "id"            => $item->getId(),
            Severity: Minor
            Found in lib/ItemRepository.php - About 1 hr to fix

              Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($jsonData)
                  {
                      if (count($jsonData)) {
                          $this->_itemName                = array_key_exists('item_name', $jsonData)?$jsonData['item_name']:'';
                          $this->_fullAmount              = array_key_exists('full_amount', $jsonData)?$jsonData['full_amount']:'';
              Severity: Minor
              Found in lib/DataObjects/Widget.php - About 1 hr to fix

                Method requestSessionToken has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function requestSessionToken(Token $token)
                    {
                
                        $payload = '';
                        $preparePayload = array(
                Severity: Minor
                Found in lib/TokenRepository.php - About 1 hr to fix

                  Method updateCompany has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function updateCompany(Company $company)
                      {
                  
                          $payload='';
                          $preparePayload = array(
                  Severity: Minor
                  Found in lib/CompanyRepository.php - About 1 hr to fix

                    Function stripBom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function stripBom($body)
                        {
                            if ( substr($body,0,3) === "\xef\xbb\xbf" )  // UTF-8
                                $body = substr($body,3);
                            else if ( substr($body,0,4) === "\xff\xfe\x00\x00" || substr($body,0,4) === "\x00\x00\xfe\xff" )  // UTF-32
                    Severity: Minor
                    Found in lib/Vendors/Httpful/Handlers/MimeHandlerAdapter.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

                    Severity
                    Category
                    Status
                    Source
                    Language