Showing 8 of 10 total issues
Method sendRequest
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function sendRequest(
string $method,
string $path,
?array $body,
ShipEngineConfig $config
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(array $config = [])
{
$assert = new Assert();
$api_key = $config['apiKey'] ?? config('shipengine.credentials.key');
$assert->isApiKeyValid($api_key);
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $message,
public string|null $requestId = null,
public string|null $source = null,
public string|null $type = null,
public string|null $errorCode = null,
Method downloadFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $directory,
string $subDirectory,
string $fileName,
array $params = [],
array|ShipEngineConfig|null $config = null,
Method updateWarehouseById
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $warehouse_id,
string $name,
array $origin_address,
array $return_address = [],
array|ShipEngineConfig|null $config = null,
Method retrieveList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $path,
array|null $params,
array|ShipEngineConfig $config,
string $responseKey,
string $responseType,
Function sendRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function sendRequest(
string $method,
string $path,
?array $body,
ShipEngineConfig $config
- 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 sendRequestWithRetries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function sendRequestWithRetries(
string $method,
string $path,
?array $body,
ShipEngineConfig $config
- 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"