bitpay/php-bitpay-client

View on GitHub
src/Bitpay/Client/Client.php

Summary

Maintainability
D
2 days
Test Coverage

File Client.php has 508 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @license Copyright 2011-2014 BitPay Inc., MIT License
 * see https://github.com/bitpay/php-bitpay-client/blob/master/LICENSE
 */
Severity: Major
Found in src/Bitpay/Client/Client.php - About 1 day to fix

    Client has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Client implements ClientInterface
    {
        /**
         * @var RequestInterface
         */
    Severity: Minor
    Found in src/Bitpay/Client/Client.php - About 2 hrs to fix

      Method getPayouts has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getPayouts($status = null)
          {
              $request = $this->createNewRequest();
              $request->setMethod(Request::METHOD_GET);
              $path = 'payouts?token='
      Severity: Major
      Found in src/Bitpay/Client/Client.php - About 2 hrs to fix

        Method createPayout has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createPayout(PayoutInterface $payout)
            {
                
                $request = $this->createNewRequest();
                $request->setMethod($request::METHOD_POST);
        Severity: Major
        Found in src/Bitpay/Client/Client.php - About 2 hrs to fix

          Method createInvoice has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function createInvoice(InvoiceInterface $invoice)
              {
                  $request = $this->createNewRequest();
                  $request->setMethod(Request::METHOD_POST);
                  $request->setPath('invoices');
          Severity: Major
          Found in src/Bitpay/Client/Client.php - About 2 hrs to fix

            Method getPayout has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getPayout($payoutId)
                {
                    $request = $this->createNewRequest();
                    $request->setMethod(Request::METHOD_GET);
                    $request->setPath(sprintf('payouts/%s?token=%s', $payoutId, $this->token->getToken()));
            Severity: Minor
            Found in src/Bitpay/Client/Client.php - About 1 hr to fix

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

                  public function createToken(array $payload = array())
                  {
                      if (isset($payload['pairingCode']) && 1 !== preg_match('/^[a-zA-Z0-9]{7}$/', $payload['pairingCode'])) {
                          throw new \InvalidArgumentException("pairing code is not legal");
                      }
              Severity: Minor
              Found in src/Bitpay/Client/Client.php - About 1 hr to fix

                Function createPayout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createPayout(PayoutInterface $payout)
                    {
                        
                        $request = $this->createNewRequest();
                        $request->setMethod($request::METHOD_POST);
                Severity: Minor
                Found in src/Bitpay/Client/Client.php - About 25 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

                Function addSignatureHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function addSignatureHeader(RequestInterface $request)
                    {
                        if (null === $this->privateKey) {
                            throw new \Bitpay\Client\BitpayException('Please set your Private Key');
                        }
                Severity: Minor
                Found in src/Bitpay/Client/Client.php - About 25 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

                There are no issues that match your filters.

                Category
                Status