Showing 29 of 29 total issues
Method withAddedProtocolHeader
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function withAddedProtocolHeader(string $header, $values = null): self
{
$new = clone $this;
$header = strtolower($header);
if ($values === null) {
Function withAddedProtocolHeader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function withAddedProtocolHeader(string $header, $values = null): self
{
$new = clone $this;
$header = strtolower($header);
if ($values === null) {
- 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 createFromParameters
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createFromParameters(array $server, array $headers = [], array $cookies = [], array $get = [], array $post = [], array $files = [], $body = null): ServerRequestInterface
Method withAddedTrustedHosts
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
array $hosts,
// Defining default headers is not secure!
array $ipHeaders = [],
array $protocolHeaders = [],
array $hostHeaders = [],
Method populateUploadedFileRecursive
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function populateUploadedFileRecursive(array &$files, $names, $tempNames, $types, $sizes, $errors): void
Function shouldOutputBody
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function shouldOutputBody(ResponseInterface $response): bool
{
if (in_array($response->getStatusCode(), self::NO_BODY_RESPONSE_CODES, true)) {
return false;
}
- 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
Avoid too many return
statements within this method. Open
return true;
Function populateUploadedFileRecursive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function populateUploadedFileRecursive(array &$files, $names, $tempNames, $types, $sizes, $errors): void
{
if (is_array($names)) {
foreach ($names as $i => $name) {
$files[$i] = [];
- 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 getUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getUrl(RequestInterface $request, array $urlHeaders): ?array
{
foreach ($urlHeaders as $header) {
if (!$request->hasHeader($header)) {
continue;
- 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"