|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of coisa/http. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Felipe Sayão Lobato Abreu <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* This source file is subject to the license that is bundled |
|
8
|
|
|
* with this source code in the file LICENSE. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace CoiSA\Http; |
|
12
|
|
|
|
|
13
|
|
|
use CoiSA\Http\Client\RequestHandlerClient; |
|
14
|
|
|
use CoiSA\Http\Handler\MiddlewareHandler; |
|
15
|
|
|
use Psr\Http\Message\RequestInterface; |
|
16
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
17
|
|
|
use Psr\Http\Message\ServerRequestFactoryInterface; |
|
18
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
|
19
|
|
|
use Psr\Http\Server\MiddlewareInterface; |
|
20
|
|
|
use Psr\Http\Server\RequestHandlerInterface; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Class Dispatcher |
|
24
|
|
|
* |
|
25
|
|
|
* @package CoiSA\Http |
|
26
|
|
|
*/ |
|
27
|
|
|
class Dispatcher implements DispatcherInterface |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @var RequestHandlerInterface |
|
31
|
|
|
*/ |
|
32
|
|
|
private $handler; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var PsrHttpClient |
|
|
|
|
|
|
36
|
|
|
*/ |
|
37
|
|
|
private $client; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Dispatcher constructor. |
|
41
|
|
|
* |
|
42
|
|
|
* @param RequestHandlerInterface $handler |
|
43
|
|
|
* @param MiddlewareInterface $middleware |
|
44
|
|
|
* @param ServerRequestFactoryInterface|null $serverRequestFactory |
|
45
|
|
|
*/ |
|
46
|
|
|
public function __construct( |
|
47
|
|
|
RequestHandlerInterface $handler, |
|
48
|
|
|
MiddlewareInterface $middleware, |
|
49
|
|
|
ServerRequestFactoryInterface $serverRequestFactory = null |
|
50
|
|
|
) { |
|
51
|
|
|
$this->handler = new MiddlewareHandler( |
|
52
|
|
|
$middleware, |
|
53
|
|
|
$handler |
|
54
|
|
|
); |
|
55
|
|
|
|
|
56
|
|
|
$this->client = new RequestHandlerClient( |
|
|
|
|
|
|
57
|
|
|
$this->handler, |
|
58
|
|
|
$serverRequestFactory |
|
59
|
|
|
); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* {@inheritdoc} |
|
64
|
|
|
*/ |
|
65
|
|
|
public function sendRequest(RequestInterface $request): ResponseInterface |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->client->sendRequest($request); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* {@inheritdoc} |
|
72
|
|
|
*/ |
|
73
|
|
|
public function handle(ServerRequestInterface $request): ResponseInterface |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->handler->handle($request); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* {@inheritdoc} |
|
80
|
|
|
*/ |
|
81
|
|
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->handler->process($request, $handler); |
|
|
|
|
|
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths