Completed
Push — master ( dc419f...9c84cd )
by Andrii
10:36
created

RelayMiddleware::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace hiapi\Core\Http\Psr15\Middleware;
5
6
7
use hiapi\Core\Endpoint\EndpointRepository;
8
use Psr\Http\Message\ResponseInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
use Psr\Http\Server\MiddlewareInterface;
11
use Psr\Http\Server\RequestHandlerInterface;
12
use Relay\Relay;
13
14
class RelayMiddleware implements MiddlewareInterface
15
{
16
    /**
17
     * @var MiddlewareInterface[]
18
     */
19
    private $middlewares;
20
21
    /**
22
     * FallbackToLegacyApiMiddleware constructor.
23
     *
24
     * @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...
25
     */
26
    public function __construct(... $middlewares)
27
    {
28
        $this->middlewares = $middlewares;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
35
    {
36
        return (new Relay($this->middlewares))->handle($request);
37
    }
38
}
39