Completed
Push — master ( 6c8b2f...a31f38 )
by Tobias
16:10
created

Visitor/Php/Symfony/ContainerAwareTransChoice.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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\Php\Symfony;
13
14
use PhpParser\Node;
15
use PhpParser\NodeVisitor;
16
use Translation\Extractor\Visitor\Php\BasePHPVisitor;
17
18
/**
19
 * @author Tobias Nyholm <[email protected]>
20
 */
21 View Code Duplication
final class ContainerAwareTransChoice extends BasePHPVisitor implements NodeVisitor
0 ignored issues
show
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 2
    public function beforeTraverse(array $nodes)
24
    {
25 2
    }
26
27 2
    public function enterNode(Node $node)
28
    {
29 2
        if (!$node instanceof Node\Expr\MethodCall) {
30 2
            return;
31
        }
32
33 2
        if (!is_string($node->name) && !$node->name instanceof Node\Identifier) {
34 1
            return;
35
        }
36 2
        $name = (string) $node->name;
37
38
        //If $this->get('translator')->trans('foobar')
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
39 2
        if ('transChoice' === $name) {
40 2
            $label = $this->getStringArgument($node, 0);
41 2
            $domain = $this->getStringArgument($node, 3);
42
43 2
            $this->addLocation($label, $node->getAttribute('startLine'), $node, ['domain' => $domain]);
44
        }
45 2
    }
46
47 2
    public function leaveNode(Node $node)
48
    {
49 2
    }
50
51 2
    public function afterTraverse(array $nodes)
52
    {
53 2
    }
54
}
55