Completed
Pull Request — master (#14)
by Tobias
22:24 queued 20:26
created

TwigEnvironmentFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 1
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
18
class TwigEnvironmentFactory
19
{
20 4
    public static function create()
21
    {
22 4
        $env = new \Twig_Environment();
23 4
        $env->addExtension(new TranslationExtension($translator = new IdentityTranslator(new MessageSelector())));
24 4
        $env->setLoader(new \Twig_Loader_String());
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Loader_String has been deprecated with message: since 1.18.1 (to be removed in 2.0)

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
25
26 4
        return $env;
27
    }
28
}
29