Showing 55 of 59 total issues
Function resolveParameters
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
protected function resolveParameters(array $refParameters, array $arguments): array
{
$parameters = [];
$nullable = 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
File PrototypeTrait.php
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
/*
* This file is part of Flight Routing.
*
Function load
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function load(array $annotations): RouteCollection
{
foreach ($annotations as $annotation) {
$reflection = $annotation['type'];
$attributes = $annotation['attributes'] ?? [];
- 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 buildCache
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function buildCache(RouteCollection $collection, bool $doCache): string
{
$dynamicRoutes = $dynamicVar = $staticRoutes = [];
$dynamicString = ":static function (string \$path): ?array {\n ";
- 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 addRoute
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function addRoute(RouteCollection $collection, Route $route, mixed $handler): RouteCollection
{
if (true !== $handler) {
if (empty($route->path)) {
throw new InvalidAnnotationException('Attributed method route path empty');
- 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
RouteCollection
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class RouteCollection implements \Countable, \ArrayAccess
{
use Traits\PrototypeTrait;
/**
Function interpolate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static function interpolate(string $uriRoute, array $uriVars, array $parameters): string
{
$required = []; // Parameters required which are missing.
$replaces = self::URI_FIXERS;
- 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 resolveParameters
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function resolveParameters(array $refParameters, array $arguments): array
{
$parameters = [];
$nullable = 0;
Function __invoke
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function __invoke(mixed $handler, array $arguments): mixed
{
if (\is_string($handler)) {
$handler = \ltrim($handler, '\\');
- 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 domain
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function domain(string ...$domains): self
{
$resolver = static function (array &$route, array $domains): void {
foreach ($domains as $domain) {
if (1 === \preg_match('/^(?:([a-z]+)\:\/{2})?([^\/]+)?$/u', $domain, $m, \PREG_UNMATCHED_AS_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 export
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function export(mixed $value, string $indent = ''): string
{
switch (true) {
case [] === $value:
return '[]';
Method buildCache
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildCache(RouteCollection $collection, bool $doCache): string
{
$dynamicRoutes = $dynamicVar = $staticRoutes = [];
$dynamicString = ":static function (string \$path): ?array {\n ";
Function injectGroups
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function injectGroups(string $prefix, array &$collection, int &$count): void
{
$unnamedRoutes = [];
foreach ($this->groups as $group) {
- 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 addRoute
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addRoute(RouteCollection $collection, Route $route, mixed $handler): RouteCollection
{
if (true !== $handler) {
if (empty($route->path)) {
throw new InvalidAnnotationException('Attributed method route path empty');
Method interpolate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function interpolate(string $uriRoute, array $uriVars, array $parameters): string
{
$required = []; // Parameters required which are missing.
$replaces = self::URI_FIXERS;
Function resolveHandler
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function resolveHandler(mixed $handler, string $namespace = null): mixed
{
if (empty($namespace)) {
return $handler;
}
- 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 compile
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function compile(string $route, array $placeholders = [], bool $reversed = false): array
{
$variables = $replaces = [];
if (\strpbrk($route, '{')) {
- 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 resolveRoute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function resolveRoute(
ServerRequestInterface $request,
callable $resolver,
mixed $handler,
callable $arguments,
Function resolveRoute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function resolveRoute(
ServerRequestInterface $request,
callable $resolver,
mixed $handler,
callable $arguments,
- 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 resolveRoute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function resolveRoute(string $path, string $method, UriInterface $uri): ?array
{
$errors = [[], []];
foreach ($this->getCollection()->getRoutes() as $i => $r) {
- 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"