Showing 24 of 24 total issues
Uri
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Uri implements UriInterface
{
/**
* Uri scheme (without "://" suffix)
*
Request
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Request extends Message implements ServerRequestInterface
{
/**
*
File Uri.php
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Pluf\Http;
use InvalidArgumentException;
Function moveTo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function moveTo($targetPath): void
{
if ($this->moved) {
throw new RuntimeException('Uploaded file already moved');
}
- 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 toHeader
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function toHeader(string $name, array $properties): string
{
$result = urlencode($name) . '=' . urlencode($properties['value']);
if (isset($properties['domain'])) {
- 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 createFromGlobals
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function createFromGlobals(array $globals): Uri
{
// Scheme
$https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
$scheme = ! $https || $https === 'off' ? 'http' : 'https';
- 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 parseUploadedFiles
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function parseUploadedFiles(array $uploadedFiles): array
{
$parsed = [];
foreach ($uploadedFiles as $field => $uploadedFile) {
if (! isset($uploadedFile['error'])) {
- 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 createFromGlobals
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createFromGlobals(array $globals): Uri
{
// Scheme
$https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
$scheme = ! $https || $https === 'off' ? 'http' : 'https';
Function isReadable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function isReadable(): bool
{
if ($this->readable === null) {
if ($this->isPipe()) {
$this->readable = true;
- 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 parseHeader
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function parseHeader($header): array
{
if (is_array($header)) {
$header = isset($header[0]) ? $header[0] : '';
}
- 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 toHeader
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function toHeader(string $name, array $properties): string
{
$result = urlencode($name) . '=' . urlencode($properties['value']);
if (isset($properties['domain'])) {
Method moveTo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function moveTo($targetPath): void
{
if ($this->moved) {
throw new RuntimeException('Uploaded file already moved');
}
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
string $scheme,
string $host,
?int $port = null,
string $path = '/',
string $query = '',
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($method, UriInterface $uri, HeadersInterface $headers, array $cookies, array $serverParams, StreamInterface $body, array $uploadedFiles = [])
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
final public function __construct($fileNameOrStream, ?string $name = null, ?string $type = null, ?int $size = null, int $error = UPLOAD_ERR_OK, bool $sapi = false)
Function getContents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getContents(): string
{
if ($this->cache && $this->finished) {
$this->cache->rewind();
return $this->cache->getContents();
- 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 createUploadedFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
StreamInterface $stream,
?int $size = null,
int $error = UPLOAD_ERR_OK,
?string $clientFilename = null,
?string $clientMediaType = null
Function read
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function read($length): string
{
$data = false;
if ($this->isReadable() && $this->stream) {
- 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 isPipe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isPipe(): bool
{
if ($this->isPipe === null) {
$this->isPipe = 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
Function isWritable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isWritable(): bool
{
if ($this->writable === null) {
$this->writable = 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"