ApplicationFactory::getRunner()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
ccs 0
cts 8
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\React\Container;
6
7
use Antidot\Application\Http\Response\ErrorResponseGenerator;
8
use Antidot\Application\Http\RouteFactory;
9
use Antidot\Application\Http\Router;
10
use Antidot\Application\Http\WebServerApplication;
11
use Antidot\Application\Http\Application;
12
use Antidot\Container\MiddlewareFactory;
13
use Antidot\React\CallablePipeline;
14
use Antidot\React\MiddlewarePipeline;
15
use Antidot\React\Runner\ReactRequestHandlerRunner;
16
use Psr\Container\ContainerInterface;
17
use React\EventLoop\LoopInterface;
18
use React\Socket\ServerInterface;
19
use Zend\HttpHandlerRunner\Emitter\EmitterStack;
0 ignored issues
show
Bug introduced by
The type Zend\HttpHandlerRunner\Emitter\EmitterStack was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Zend\HttpHandlerRunner\RequestHandlerRunner;
0 ignored issues
show
Bug introduced by
The type Zend\HttpHandlerRunner\RequestHandlerRunner was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
class ApplicationFactory
23
{
24
    public function __invoke(ContainerInterface $container): Application
25
    {
26
        $pipeline = new MiddlewarePipeline(
27
            $container->get(LoopInterface::class)
28
        );
29
        return new WebServerApplication(
30
            $this->getRunner($container, $pipeline),
31
            $pipeline,
32
            $container->get(Router::class),
33
            $container->get(MiddlewareFactory::class),
34
            $container->get(RouteFactory::class)
35
        );
36
    }
37
38
    private function getRunner(ContainerInterface $container, CallablePipeline $pipeline): RequestHandlerRunner
39
    {
40
        return new ReactRequestHandlerRunner(
41
            $pipeline,
42
            $container->get(EmitterStack::class),
43
            $container->get(ErrorResponseGenerator::class),
44
            $container->get(ServerInterface::class),
45
            $container->get(LoopInterface::class)
46
        );
47
    }
48
}
49