Completed
Push — master ( d76c5e...03e4c2 )
by Tobias
03:46
created

Twig2TranslationBlock::enterNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 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
use Translation\Extractor\Visitor\BaseVisitor;
15
use Twig_Environment;
16
use Twig_Node;
17
18
/**
19
 * @author Tobias Nyholm <[email protected]>
20
 */
21 View Code Duplication
final class Twig2TranslationBlock extends BaseVisitor implements \Twig_NodeVisitorInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /**
24
     * @var WorkerTranslationBlock
25
     */
26
    private $worker;
27
28
    public function __construct()
29
    {
30
        $this->worker = new WorkerTranslationBlock();
31
    }
32
33
    public function enterNode(Twig_Node $node, Twig_Environment $env)
34
    {
35
        return $this->worker->work($node, $this->collection, function () {
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->worker->work($nod...AbsoluteFilePath(); }); of type Twig_Node|Twig_NodeInterface adds the type Twig_NodeInterface to the return on line 35 which is incompatible with the return type declared by the interface Twig_NodeVisitorInterface::enterNode of type Twig_Node.
Loading history...
36
            return $this->getAbsoluteFilePath();
37
        });
38
    }
39
40
    public function leaveNode(Twig_Node $node, Twig_Environment $env)
41
    {
42
        return $node;
43
    }
44
45
    public function getPriority()
46
    {
47
        return 0;
48
    }
49
}
50