PugRendererFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 12
ccs 9
cts 9
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Antidot\Render\Phug\Container;
4
5
use Antidot\Render\Phug\Container\Config\PugConfig;
6
use Antidot\Render\Phug\PugTemplateRenderer;
7
use Antidot\Render\TemplateRenderer;
8
use Psr\Container\ContainerInterface;
9
use Pug\Pug;
10
11
class PugRendererFactory
12
{
13 1
    public function __invoke(ContainerInterface $container): TemplateRenderer
14
    {
15 1
        $pugConfig = PugConfig::createFromAntidotConfig($container->get('config'));
16
17 1
        return new PugTemplateRenderer(
18 1
            $container->get(Pug::class),
19 1
            $pugConfig->get('default_params'),
20 1
            $pugConfig->get('globals'),
21 1
            array_merge(
22 1
                $pugConfig->templates(),
23
                [
24 1
                    'template_path' => $pugConfig->get('template_path')
25
                ]
26
            )
27
        );
28
    }
29
}
30