PromisePay/promisepay-php

View on GitHub

Showing 72 of 72 total issues

Request has 77 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request
{

    // Option constants
    const SERIALIZE_PAYLOAD_NEVER   = 0;
Severity: Major
Found in lib/Vendors/Httpful/Request.php - About 1 day to fix

    File Request.php has 583 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Httpful;
    
    use Httpful\Exception\ConnectionErrorException;
    Severity: Major
    Found in lib/Vendors/Httpful/Request.php - About 1 day to fix

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

      <?php
      namespace PromisePay\DataObjects;
      /**
       * Class BPayDetails
       * @package PromisePay\DataObjects
      Severity: Major
      Found in lib/DataObjects/BPayDetails.php and 1 other location - About 1 day to fix
      lib/DataObjects/Object.php on lines 1..98

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

      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

      <?php
      namespace PromisePay\DataObjects;
      /**
       * Class Object
       * @package PromisePay\DataObjects
      Severity: Major
      Found in lib/DataObjects/Object.php and 1 other location - About 1 day to fix
      lib/DataObjects/BPayDetails.php on lines 1..102

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

      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

      Widget has 55 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Widget
      {
      
          private $_itemName;
      
      
      Severity: Major
      Found in lib/DataObjects/Widget.php - About 7 hrs to fix

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

            public function refund( $itemId,  $refundAmount,  $refundMessage)
            {
                $this->checkIdNotNull($itemId);
                $this->checkIdNotNull($refundAmount);
                $this->checkIdNotNull($refundMessage);
        Severity: Major
        Found in lib/ItemRepository.php and 1 other location - About 7 hrs to fix
        lib/ItemRepository.php on lines 396..425

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

        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 requestRefund( $itemId,  $refundAmount,  $refundMessage)
            {
                $this->checkIdNotNull($itemId);
                $this->checkIdNotNull($refundAmount);
                $this->checkIdNotNull($refundMessage);
        Severity: Major
        Found in lib/ItemRepository.php and 1 other location - About 7 hrs to fix
        lib/ItemRepository.php on lines 427..456

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

        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

                if(count($jsonData))
                {
                    $this->_description         = array_key_exists('description',$jsonData)?$jsonData['description']:'';
                    $this->_amount              = array_key_exists('amount',$jsonData)?$jsonData['amount']:'';
                    $this->_currency            = array_key_exists('currency', $jsonData)?$jsonData['currency']:'';
        Severity: Major
        Found in lib/DataObjects/Transaction.php and 1 other location - About 6 hrs to fix
        lib/DataObjects/Bank.php on lines 41..50

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

        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

                if (count($jsonData))
                {
                    $this->_bankName      = array_key_exists('bank_name',      $jsonData)?$jsonData['bank_name']:'';
                    $this->_country       = array_key_exists('country',        $jsonData)?$jsonData['country']:'';
                    $this->_accountName   = array_key_exists('account_name',   $jsonData)?$jsonData['account_name']:'' ;
        Severity: Major
        Found in lib/DataObjects/Bank.php and 1 other location - About 6 hrs to fix
        lib/DataObjects/Transaction.php on lines 41..50

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

        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

            public function makePayment($itemId, $accountId)
            {
                $this->checkIdNotNull($itemId);
                $this->checkIdNotNull($accountId);
        
        
        Severity: Major
        Found in lib/ItemRepository.php and 2 other locations - About 6 hrs to fix
        lib/ItemRepository.php on lines 281..308
        lib/ItemRepository.php on lines 310..337

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

        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

            public function requestRelease($itemId, $releaseAmount)
            {
                $this->checkIdNotNull($itemId);
                $this->checkIdNotNull($releaseAmount);
        
        
        Severity: Major
        Found in lib/ItemRepository.php and 2 other locations - About 6 hrs to fix
        lib/ItemRepository.php on lines 238..264
        lib/ItemRepository.php on lines 281..308

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

        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

            public function releasePayment($itemId, $releaseAmount)
            {
                $this->checkIdNotNull($itemId);
                $this->checkIdNotNull($releaseAmount);
        
        
        Severity: Major
        Found in lib/ItemRepository.php and 2 other locations - About 6 hrs to fix
        lib/ItemRepository.php on lines 238..264
        lib/ItemRepository.php on lines 310..337

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

        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 ItemRepository.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        namespace PromisePay;
        
        use PromisePay\DataObjects\BPayDetails;
        use PromisePay\DataObjects\Fee;
        Severity: Minor
        Found in lib/ItemRepository.php - About 5 hrs to fix

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

                  if(count($jsonData))
                  {
                      $this->_type     = array_key_exists('card_type',$jsonData)?$jsonData['card_type']:'';
                      $this->_fullName = array_key_exists('full_name',$jsonData)?$jsonData['full_name']:'';
                      $this->_number   = array_key_exists('number',$jsonData)?$jsonData['number']:'';
          Severity: Major
          Found in lib/DataObjects/Card.php and 1 other location - About 5 hrs to fix
          lib/DataObjects/Address.php on lines 36..44

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

          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

                  if (count($jsonData))
                  {
                      $this->_addressLine1 = array_key_exists('address_line1', $jsonData) ? $jsonData['address_line1'] : '';
                      $this->_addressLine2 = array_key_exists('address_line2', $jsonData) ? $jsonData['address_line2'] : '';
                      $this->_postalCode = array_key_exists('postal_code', $jsonData) ? $jsonData['postal_code'] : '';
          Severity: Major
          Found in lib/DataObjects/Address.php and 1 other location - About 5 hrs to fix
          lib/DataObjects/Card.php on lines 37..46

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

          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

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

          class Item extends Object
          {
              /**
               * @var
               */
          Severity: Minor
          Found in lib/DataObjects/Item.php - About 4 hrs to fix

            Token has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Token
            {
                /**
                 * @var
                 */
            Severity: Minor
            Found in lib/DataObjects/Token.php - About 4 hrs to fix

              Function _curlPrep has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _curlPrep()
                  {
                      // Check for required stuff
                      if (!isset($this->uri))
                          throw new \Exception('Attempting to send a request before defining a URI endpoint.');
              Severity: Minor
              Found in lib/Vendors/Httpful/Request.php - About 4 hrs 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

              User has 31 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class User extends Object
              {
                  /**
                   * @var
                   */
              Severity: Minor
              Found in lib/DataObjects/User.php - About 3 hrs to fix

                Method _curlPrep has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _curlPrep()
                    {
                        // Check for required stuff
                        if (!isset($this->uri))
                            throw new \Exception('Attempting to send a request before defining a URI endpoint.');
                Severity: Major
                Found in lib/Vendors/Httpful/Request.php - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language