Completed
Pull Request — master (#14)
by Tobias
20:59 queued 19:01
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
namespace Translation\Extractor\Tests\Functional\Visitor\Twig;
4
5
use Symfony\Component\Translation\MessageSelector;
6
use Symfony\Component\Translation\IdentityTranslator;
7
use Symfony\Bridge\Twig\Extension\TranslationExtension;
8
9
class TwigEnvironmentFactory
10
{
11 4
    public static function create()
12
    {
13 4
        $env = new \Twig_Environment();
14 4
        $env->addExtension(new TranslationExtension($translator = new IdentityTranslator(new MessageSelector())));
15 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...
16
17 4
        return $env;
18
    }
19
}
20