src/Bitpay/Client/Client.php
File Client.php
has 508 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* @license Copyright 2011-2014 BitPay Inc., MIT License
* see https://github.com/bitpay/php-bitpay-client/blob/master/LICENSE
*/
Client
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Client implements ClientInterface
{
/**
* @var RequestInterface
*/
Method getPayouts
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getPayouts($status = null)
{
$request = $this->createNewRequest();
$request->setMethod(Request::METHOD_GET);
$path = 'payouts?token='
Method createPayout
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createPayout(PayoutInterface $payout)
{
$request = $this->createNewRequest();
$request->setMethod($request::METHOD_POST);
Method createInvoice
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createInvoice(InvoiceInterface $invoice)
{
$request = $this->createNewRequest();
$request->setMethod(Request::METHOD_POST);
$request->setPath('invoices');
Method getPayout
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getPayout($payoutId)
{
$request = $this->createNewRequest();
$request->setMethod(Request::METHOD_GET);
$request->setPath(sprintf('payouts/%s?token=%s', $payoutId, $this->token->getToken()));
Method createToken
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
}
Function createPayout
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function createPayout(PayoutInterface $payout)
{
$request = $this->createNewRequest();
$request->setMethod($request::METHOD_POST);
- Read upRead up
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
Open
protected function addSignatureHeader(RequestInterface $request)
{
if (null === $this->privateKey) {
throw new \Bitpay\Client\BitpayException('Please set your Private Key');
}
- Read upRead up
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"