Completed
Push — master ( fca11f...8165c2 )
by Tobias
10:22
created

TwigVisitorFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 14
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 2
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\Visitor\Twig;
13
14
/**
15
 * Create a TwigVisitor depending on what version of Twig is installed.
16
 *
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class TwigVisitorFactory
20
{
21
    /**
22
     * @return Twig1Visitor|Twig2Visitor
23
     */
24
    public static function create()
25
    {
26
        if (-1 === version_compare(\Twig_Environment::VERSION, '2.0')) {
27
            return new Twig1Visitor();
28
        }
29
30
        return new Twig2Visitor();
31
    }
32
}
33