Http::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 12
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jellyfish\Application;
6
7
use Jellyfish\Kernel\KernelInterface;
8
9
class Http
10
{
11
    /**
12
     * @var \Jellyfish\Kernel\KernelInterface
13
     */
14
    protected $kernel;
15
16
    /**
17
     * @param \Jellyfish\Kernel\KernelInterface $kernel
18
     */
19
    public function __construct(KernelInterface $kernel)
20
    {
21
        $this->kernel = $kernel;
22
    }
23
24
    /**
25
     * @return void
26
     */
27
    public function run(): void
28
    {
29
        /** @var \Psr\Http\Message\ServerRequestInterface $request */
30
        $request = $this->kernel->getContainer()->offsetGet('request');
31
        /** @var \League\Route\Router $router */
32
        $router = $this->kernel->getContainer()->offsetGet('router');
33
        /** @var \Zend\HttpHandlerRunner\Emitter\EmitterInterface $emitter */
34
        $emitter = $this->kernel->getContainer()->offsetGet('emitter');
35
36
        $response = $router->dispatch($request);
37
38
        $emitter->emit($response);
39
    }
40
}
41