Completed
Push — master ( 269a50...019c60 )
by Tobias
04:32
created

TwigEnvironmentFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 11
c 0
b 0
f 0
rs 10
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Extractor\Tests\Functional\Visitor\Twig;
13
14
use Symfony\Component\Translation\MessageSelector;
15
use Symfony\Component\Translation\IdentityTranslator;
16
use Symfony\Bridge\Twig\Extension\TranslationExtension;
17
use Translation\Extractor\Twig\TranslationExtension as PHPTranslationExtension;
18
19
/**
20
 * Create a TwigEnvironment that will be used in tests.
21
 *
22
 * @author Tobias Nyholm <[email protected]>
23
 */
24
final class TwigEnvironmentFactory
25
{
26
    public static function create()
27
    {
28
        $env = new \Twig_Environment(new \Twig_Loader_Array([]));
29
        $env->addExtension(new TranslationExtension($translator = new IdentityTranslator(new MessageSelector())));
30
        $env->addExtension(new PHPTranslationExtension());
31
32
        return $env;
33
    }
34
}
35