src/HandlerContainer.php
Method process
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function process(Request $request) : Response
{
$router = $request->attributes->get('router');
$next = next($this->middlewareStack);
Function process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function process(Request $request) : Response
{
$router = $request->attributes->get('router');
$next = next($this->middlewareStack);
- 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
Open
return new Response(
$return,
Response::HTTP_OK,
array('content-type' => 'text/html')
);
Doc-block of $stack
in __construct
contains phpdoc param type \Circuit\Interfaces\Middleware
which is incompatible with the param type array
declared in the signature Open
Open
* @param Middleware|string[] $stack A list of middleware (Middleware Objects or named Middleware) to be called
- Exclude checks
Returning type \Symfony\Component\HttpFoundation\JsonResponse
but process()
is declared to return \Symfony\Component\HttpFoundation\Response
Open
Open
return new JsonResponse(
- Exclude checks
Argument 5 (container)
is \Circuit\Psr\Container\ContainerInterface
but \Circuit\ControllerParams::__construct()
takes \Psr\Container\ContainerInterface
defined at /code/src/ControllerParams.php:36
Open
Open
$params = new ControllerParams($uri, $this->controllerClass, $this->controllerMethod, $args, $router->getServiceContainer());
- Exclude checks
Doc-block of $stack
in addMiddleware
contains phpdoc param type \Circuit\Interfaces\Middleware
which is incompatible with the param type array
declared in the signature Open
Open
* @param Middleware|string[] $stack Middleware to add to this route.
- Exclude checks
Possibly zero references to use statement for classlike/namespace ParameterDereferencer
(\Circuit\Interfaces\ParameterDereferencer)
Open
Open
use Circuit\Interfaces\ParameterDereferencer;
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
Open
$return = (new $params->className($params->container))->{$params->method}($request, ...array_values($params->args));
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
Open
$params = new ControllerParams($uri, $this->controllerClass, $this->controllerMethod, $args, $router->getServiceContainer());
- Exclude checks