Showing 46 of 46 total issues
Function getPreflightResponse
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected function getPreflightResponse(RequestInterface $request, ResponseInterface $response): ResponseInterface
{
$response = $response
->withHeader('Access-Control-Allow-Origin', true === $this->options['allow_origin'] ? '*' : $request->getHeaderLine('Origin'))
->withHeader('Vary', $response->hasHeader('Vary') ? $response->getHeaderLine('Vary') . ', Origin' : 'Origin');
- 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 process
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
$response = $handler->handle($request);
if (empty($cspHeaders = $this->getCspHeaders($response))) {
- 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 process
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
$response = $handler->handle($request);
if (!empty($framePolicy = $this->policies['frame_policy'])) {
- 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 hasOrigin
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function hasOrigin(RequestInterface $request): bool
{
if (true === $allowedOrigin = $this->options['allow_origin']) {
return 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
Method process
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
if ($request instanceof HttpRequest) {
if (!$request->getRequest()->hasSession(true)) {
// This variable prevents calling `$this->session` twice in case the Request (and the below factory) is cloned
Uri
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Uri implements UriInterface
{
private const SCHEMES = ['http' => 80, 'https' => 443];
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
Function process
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
if ($request instanceof HttpRequest) {
if (!$request->getRequest()->hasSession(true)) {
// This variable prevents calling `$this->session` twice in case the Request (and the below factory) is cloned
- 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 getPreflightResponse
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getPreflightResponse(RequestInterface $request, ResponseInterface $response): ResponseInterface
{
$response = $response
->withHeader('Access-Control-Allow-Origin', true === $this->options['allow_origin'] ? '*' : $request->getHeaderLine('Origin'))
->withHeader('Vary', $response->hasHeader('Vary') ? $response->getHeaderLine('Vary') . ', Origin' : 'Origin');
Function createUriString
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function createUriString(string $scheme, string $authority, string $path, string $query, string $fragment): string
{
$uri = '';
if ('' !== $scheme) {
$uri .= $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
Function getLine
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected static function getLine(StreamInterface $stream): string
{
$line = '';
$crFound = 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 splitStream
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected static function splitStream(StreamInterface $stream): array
{
$headers = [];
$currentHeader = 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 encodeResponseSetCookieHeaders
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function encodeResponseSetCookieHeaders(UriInterface $requestUri, ResponseInterface $response): ResponseInterface
{
$matchCookie = static function (Cookie $cookie) use ($requestUri): bool {
$cookiePath = $cookie->getPath();
$cookieDomain = $cookie->getDomain();
- 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 process
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
$response = $handler->handle($request);
if (empty($cspHeaders = $this->getCspHeaders($response))) {
Method process
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
$response = $handler->handle($request);
if (!empty($framePolicy = $this->policies['frame_policy'])) {
Function buildPolicy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function buildPolicy(array $config, ?array &$nonces = []): array
{
$policies = [];
foreach ($config as $type => $policy) {
- 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 withCacheControl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function withCacheControl(array $options, ResponseInterface $response): ResponseInterface
{
$cacheControl = [];
self::validateOptions($options);
- 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 encodeResponseSetCookieHeaders
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function encodeResponseSetCookieHeaders(UriInterface $requestUri, ResponseInterface $response): ResponseInterface
{
$matchCookie = static function (Cookie $cookie) use ($requestUri): bool {
$cookiePath = $cookie->getPath();
$cookieDomain = $cookie->getDomain();
Method createResponse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createResponse(ResponseInterface $response, RequestInterface $request, CacheItemInterface $cacheItem)
{
if (304 === $response->getStatusCode()) {
// The cached response we have is still valid
if (!empty($data = $cacheItem->get())) {
Method withCacheControl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function withCacheControl(array $options, ResponseInterface $response): ResponseInterface
{
$cacheControl = [];
self::validateOptions($options);
Function process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
$cookieParams = [];
// Handle an incoming request cookie.
- 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"