Showing 10 of 10 total issues
Invoice
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class Invoice
{
/** @var string */
private $number;
Function fromArray
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function fromArray(array $data)
{
$invoice = new Invoice();
if (isset($data['number'])) {
$invoice->setNumber($data['number']);
- 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 __construct
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($apiToken, $options = [])
{
$this->apiToken = $apiToken;
$this->target = self::DEFAULT_TARGET;
- 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
Method fromArray
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromArray(array $data)
{
$invoice = new Invoice();
if (isset($data['number'])) {
$invoice->setNumber($data['number']);
File Invoice.php
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Invoice;
use Invoice\Exception\UnsupportedCurrencyException;
Method __construct
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($apiToken, $options = [])
{
$this->apiToken = $apiToken;
$this->target = self::DEFAULT_TARGET;
Method fromArray
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromArray($data)
{
$address = new Address();
if (isset($data['street'])) {
$address->setStreet($data['street']);
Method encodeInvoice
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function encodeInvoice(Invoice $invoice)
{
$data = [
'id' => $invoice->getId(),
'number' => $invoice->getNumber(),
Function fromArray
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function fromArray($data)
{
$address = new Address();
if (isset($data['street'])) {
$address->setStreet($data['street']);
- 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 fromArray
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function fromArray($data)
{
$item = new InvoiceItem();
if (isset($data['quantity'])) {
$item->setQuantity($data['quantity']);
- 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"