ReactHttpServer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 13
c 2
b 1
f 0
dl 0
loc 27
ccs 0
cts 18
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 3 1
A __construct() 0 4 1
A execute() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\React;
6
7
use Antidot\Application\Http\Application;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class ReactHttpServer extends Command
13
{
14
    public const NAME = 'react-server:http';
15
    private array $config;
16
17
    public function __construct(array $config)
18
    {
19
        parent::__construct();
20
        $this->config = $config;
21
    }
22
23
    protected function configure(): void
24
    {
25
        $this->setName(self::NAME);
26
    }
27
28
    protected function execute(InputInterface $input, OutputInterface $output)
29
    {
30
        $middleware = require $this->config['middleware_path'];
31
        $routes = require $this->config['router_path'];
32
        $container = require $this->config['container_path'];
33
        /** @var Application $application */
34
        $application = $container->get(Application::class);
35
        $middleware($application, $container);
36
        $routes($application, $container);
37
38
        $application->run();
39
    }
40
}
41