ApplicationFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 24
ccs 0
cts 21
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 1
A getRunner() 0 8 1
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