Slick   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A update() 0 4 2
1
<?php
2
3
/**
4
 * This file is part of template
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Slick\Template\Extension;
13
14
use Slick\Template\Engine\TwigTemplateEngine;
15
use Slick\Template\EngineExtensionInterface;
16
use Slick\Template\Extension\Twig\TwigSlickExtension;
17
use Slick\Template\TemplateEngineInterface;
18
19
/**
20
 * Slick
21
 *
22
 * @package Slick\Template\Extension
23
 */
24
final class Slick implements EngineExtensionInterface
25
{
26
27
    use TwigEngineMethods;
28
29
    public function __construct(private readonly SlickApp $app)
30
    {
31
    }
32
33
    protected string $twigExtensionName = TwigSlickExtension::class;
34
35
    public function update(TemplateEngineInterface $engine): void
36
    {
37
        if ($engine instanceof TwigTemplateEngine) {
38
            $engine->sourceEngine()->addExtension(new TwigSlickExtension($this->app));
39
        }
40
    }
41
42
43
}
44