Test Failed
Push — master ( 260f64...3b7304 )
by Mehmet
04:12
created

TwigFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 3
1
<?php
2
declare(strict_types=1);
3
4
namespace SelamiApp\Factories;
5
6
use Zend\ServiceManager\Factory\FactoryInterface;
7
use Interop\Container\ContainerInterface;
8
use Twig_Loader_Filesystem;
9
use Twig_Environment;
10
11
class TwigFactory implements FactoryInterface
12
{
13
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
14
    {
15
        $config = $container->get('config');
16
        $globals = $container->get('globals');
17
        $loader = new Twig_Loader_Filesystem($config['app']['templates_path']);
18
        $twig = new Twig_Environment($loader, $config['app']['twig']);
19
        $twig->addGlobal('lang', $globals['runtime_lang']);
20
        return $twig;
21
    }
22
}