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

TwigFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 1
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
}