PsrContainerRenderer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 18
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Midnight\Block\Renderer;
5
6
use Midnight\Block\BlockInterface;
7
use Psr\Container\ContainerExceptionInterface;
8
use Psr\Container\ContainerInterface;
9
10
class PsrContainerRenderer implements RendererInterface
11
{
12
    /** @var ContainerInterface */
13
    private $container;
14
15
    public function __construct(ContainerInterface $container)
16
    {
17
        $this->container = $container;
18
    }
19
20
    /**
21
     * @throws ContainerExceptionInterface
22
     */
23
    public function render(BlockInterface $block): string
24
    {
25
        return $this->container->get($block->getTypeName())->render($block);
26
    }
27
}
28