|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of Spiral Framework package. |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace Spiral\Bootloader\Server; |
|
13
|
|
|
|
|
14
|
|
|
use Spiral\Boot\Bootloader\Bootloader; |
|
15
|
|
|
use Spiral\Boot\EnvironmentInterface as GlobalEnvironmentInterface; |
|
16
|
|
|
use Spiral\Core\Container; |
|
17
|
|
|
use Spiral\Goridge\RPC\RPC; |
|
|
|
|
|
|
18
|
|
|
use Spiral\Goridge\RPC\RPCInterface; |
|
|
|
|
|
|
19
|
|
|
use Spiral\Http\Diactoros\ServerRequestFactory; |
|
20
|
|
|
use Spiral\Http\Diactoros\StreamFactory; |
|
21
|
|
|
use Spiral\Http\Diactoros\UploadedFileFactory; |
|
22
|
|
|
use Spiral\RoadRunner\Environment; |
|
|
|
|
|
|
23
|
|
|
use Spiral\RoadRunner\EnvironmentInterface; |
|
|
|
|
|
|
24
|
|
|
use Spiral\RoadRunner\Http\PSR7Worker; |
|
|
|
|
|
|
25
|
|
|
use Spiral\RoadRunner\Http\PSR7WorkerInterface; |
|
|
|
|
|
|
26
|
|
|
use Spiral\RoadRunner\Worker; |
|
27
|
|
|
use Spiral\RoadRunner\WorkerInterface; |
|
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
class RoadRunnerBootloader extends Bootloader |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @param Container $container |
|
33
|
|
|
*/ |
|
34
|
|
|
public function boot(Container $container) |
|
35
|
|
|
{ |
|
36
|
|
|
// |
|
37
|
|
|
// Register RoadRunner Environment |
|
38
|
|
|
// |
|
39
|
|
|
$environmentRegistrar = static function (GlobalEnvironmentInterface $env): EnvironmentInterface { |
|
40
|
|
|
return new Environment($env->getAll()); |
|
41
|
|
|
}; |
|
42
|
|
|
|
|
43
|
|
|
$container->bindSingleton(EnvironmentInterface::class, $environmentRegistrar); |
|
44
|
|
|
$container->bindSingleton(Environment::class, $environmentRegistrar); |
|
45
|
|
|
|
|
46
|
|
|
// |
|
47
|
|
|
// Register RPC |
|
48
|
|
|
// |
|
49
|
|
|
$rpcRegistrar = static function (EnvironmentInterface $env): RPCInterface { |
|
50
|
|
|
return RPC::create($env->getRPCAddress()); |
|
51
|
|
|
}; |
|
52
|
|
|
|
|
53
|
|
|
$container->bindSingleton(RPCInterface::class, $rpcRegistrar); |
|
54
|
|
|
$container->bindSingleton(RPC::class, $rpcRegistrar); |
|
55
|
|
|
|
|
56
|
|
|
// |
|
57
|
|
|
// Register Worker |
|
58
|
|
|
// |
|
59
|
|
|
$workerRegistrar = static function (EnvironmentInterface $env): WorkerInterface { |
|
60
|
|
|
return Worker::createFromEnvironment($env); |
|
|
|
|
|
|
61
|
|
|
}; |
|
62
|
|
|
|
|
63
|
|
|
$container->bindSingleton(WorkerInterface::class, $workerRegistrar); |
|
64
|
|
|
$container->bindSingleton(Worker::class, $workerRegistrar); |
|
65
|
|
|
|
|
66
|
|
|
// |
|
67
|
|
|
// Register PSR Worker |
|
68
|
|
|
// |
|
69
|
|
|
$registrar = static function ( |
|
70
|
|
|
WorkerInterface $worker, |
|
71
|
|
|
ServerRequestFactory $requests, |
|
72
|
|
|
StreamFactory $streams, |
|
73
|
|
|
UploadedFileFactory $uploads |
|
74
|
|
|
): PSR7WorkerInterface { |
|
75
|
|
|
return new PSR7Worker( |
|
76
|
|
|
$worker, |
|
77
|
|
|
$requests, |
|
78
|
|
|
$streams, |
|
79
|
|
|
$uploads |
|
80
|
|
|
); |
|
81
|
|
|
}; |
|
82
|
|
|
|
|
83
|
|
|
$container->bindSingleton(PSR7WorkerInterface::class, $registrar); |
|
84
|
|
|
$container->bindSingleton(PSR7Worker::class, $registrar); |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
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