Http   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 8
c 1
b 0
f 1
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 12 1
A __construct() 0 3 1
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