bitpay/php-bitpay-client

View on GitHub

Showing 52 of 52 total issues

Invoice has 64 functions (exceeds 20 allowed). Consider refactoring.
Open

class Invoice implements InvoiceInterface
{
    /**
     * @var CurrencyInterface
     */
Severity: Major
Found in src/Bitpay/Invoice.php - About 1 day to fix

    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

      File Invoice.php has 378 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: Minor
      Found in src/Bitpay/Invoice.php - About 5 hrs to fix

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

        class Payout implements PayoutInterface
        {
            /**
             * @var string
             */
        Severity: Minor
        Found in src/Bitpay/Payout.php - About 4 hrs to fix

          Bill has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Bill implements BillInterface
          {
              /**
               * @var array
               */
          Severity: Minor
          Found in src/Bitpay/Bill.php - About 3 hrs to fix

            Function generateKeypair has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                final public function generateKeypair($keybits = 512, $digest_alg = 'sha512')
                {
                    try {
                        /* see: http://www.php.net/manual/en/function.openssl-pkey-new.php */
                        if (function_exists('openssl_pkey_new')) {
            Severity: Minor
            Found in src/Bitpay/Crypto/OpenSSLExtension.php - About 2 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

            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

              File Util.php has 275 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: Minor
              Found in src/Bitpay/Util/Util.php - About 2 hrs to fix

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

                class User implements UserInterface
                {
                    /**
                     * @var string
                     */
                Severity: Minor
                Found in src/Bitpay/User.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 pointAdd has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function pointAdd(PointInterface $P, PointInterface $Q)
                        {
                            if ($P->isInfinity()) {
                                return $Q;
                            }
                    Severity: Major
                    Found in src/Bitpay/Util/Util.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 pemEncode has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function pemEncode($keypair)
                              {
                                  if (is_array($keypair) && (strlen($keypair[0]) < 64 || strlen($keypair[1]) < 128)) {
                                      throw new \Exception('Invalid or corrupt secp256k1 keypair provided. Cannot decode the supplied PEM data.');
                                  }
                          Severity: Minor
                          Found in src/Bitpay/PrivateKey.php - About 1 hr 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

                              Function checkRequirements has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function checkRequirements()
                                  {
                                      $requirements = array();
                              
                                      // PHP Version
                              Severity: Minor
                              Found in src/Bitpay/Util/Util.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

                              Function load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function load($resource, $type = null)
                                  {
                                      // validation
                                      foreach (array_keys($resource) as $namespace) {
                                          if (in_array($namespace, array('imports', 'paramters', 'services'))) {
                              Severity: Minor
                              Found in src/Bitpay/DependencyInjection/Loader/ArrayLoader.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

                              Method generateKeypair has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  final public function generateKeypair($keybits = 512, $digest_alg = 'sha512')
                                  {
                                      try {
                                          /* see: http://www.php.net/manual/en/function.openssl-pkey-new.php */
                                          if (function_exists('openssl_pkey_new')) {
                              Severity: Minor
                              Found in src/Bitpay/Crypto/OpenSSLExtension.php - About 1 hr to fix

                                Method sign has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function sign($data)
                                    {
                                        if (!ctype_xdigit($this->hex)) {
                                            throw new \Exception('The private key must be in hex format.');
                                        }
                                Severity: Minor
                                Found in src/Bitpay/PrivateKey.php - About 1 hr to fix

                                  Method serializeSig has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static function serializeSig($r, $s)
                                      {
                                          $dec  = '';
                                          $byte = '';
                                          $seq  = '';
                                  Severity: Minor
                                  Found in src/Bitpay/PrivateKey.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language