RelayMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace hiapi\Core\Http\Psr15\Middleware;
5
6
use hiapi\Core\Endpoint\EndpointRepository;
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\MiddlewareInterface;
10
use Psr\Http\Server\RequestHandlerInterface;
11
use Relay\Relay;
12
13
class RelayMiddleware implements MiddlewareInterface
14
{
15
    /**
16
     * @var MiddlewareInterface[]
17
     */
18
    private $middlewares;
19
20
    /**
21
     * FallbackToLegacyApiMiddleware constructor.
22
     *
23
     * @param EndpointRepository $endpointRepository
0 ignored issues
show
Bug introduced by
There is no parameter named $endpointRepository. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
24
     */
25
    public function __construct(... $middlewares)
26
    {
27
        $this->middlewares = $middlewares;
28
    }
29
30
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
31
    {
32
        return (new Relay($this->middlewares))->handle($request);
33
    }
34
}
35