Showing 36 of 36 total issues
Sessions
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class Sessions implements SessionsInterface
{
const SESSION_KEY = '__SESSIONS_SESSION__';
const SESSION_ID_LENGTH = 32;
SetCookie
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class SetCookie
{
/** @var string */
private $name;
/** @var string|null */
Cookie
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Cookie implements CookieInterface
{
const EXPIRY_FORMAT = 'l, d-M-Y H:i:s T';
/**
File Sessions.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async\Http;
Function getHeaders
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected static function getHeaders(array $server)
{
$headers = array();
static $pick = array('CONTENT_', 'HTTP_');
foreach ($server as $key => $value) {
- 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 getUri
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function getUri(array $server)
{
$uri = new Uri();
$scheme = isset($server['HTTPS']) && ($server['HTTPS'] === 'on') ? 'https' : 'http';
$uri = $uri->withScheme($scheme);
- 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
File SetCookie.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Async\Http;
Method getUri
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getUri(array $server)
{
$uri = new Uri();
$scheme = isset($server['HTTPS']) && ($server['HTTPS'] === 'on') ? 'https' : 'http';
$uri = $uri->withScheme($scheme);
Method fromGlobals
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromGlobals(array $globals): Uri
{
// Scheme
$https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
$scheme = !$https || $https === 'off' ? 'http' : 'https';
Function fromGlobals
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function fromGlobals(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
Method fromString
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromString(string $string): self
{
$rawAttributes = Cookie::splitOnDelimiter($string);
$rawAttribute = \array_shift($rawAttributes);
Method validateHeader
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function validateHeader(string $header, $values = []): void
{
if (!\preg_match('@^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$@', $header)) {
throw new \InvalidArgumentException(
\sprintf(
Function requestAllHeaders
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function requestAllHeaders()
{
$headers = [];
$copy_server = array(
'CONTENT_TYPE' => 'Content-Type',
- 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
Function __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($file, $size, $error, $clientFilename = null, $clientMediaType = null)
{
if (\is_int($error) && (0 <= $error) && (8 >= $error)) {
$this->error = $error;
} else {
- 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 fromString
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function fromString(string $string): self
{
$rawAttributes = Cookie::splitOnDelimiter($string);
$rawAttribute = \array_shift($rawAttributes);
- 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 create
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create(string $uri = ''): UriInterface
{
$obj = new self();
if (empty($uri)) {
return $obj;
Method __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(string $id = '', $cacheLimiter = 'nocache', $cacheExpire = 180)
{
$this->cacheLimiter = empty($cacheLimiter) ? 'nocache' : $cacheLimiter;
$this->cacheExpire = (int) $cacheExpire;
Method create
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create($header)
{
$parts = \preg_split('~\\s*[;]\\s*~', $header);
list($name, $value) = \explode('=', \array_shift($parts), 2);
$cookie = new self($name);
Method parseUploadedFiles
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function parseUploadedFiles(array $uploadedFiles): array
{
$parsed = [];
foreach ($uploadedFiles as $field => $uploadedFile) {
if (!isset($uploadedFile['error'])) {