Code Duplication    Length = 7-8 lines in 2 locations

src/Visitor/Twig/TranslationFilter.php 1 location

@@ 47-54 (lines=8) @@
44
        $index = 'trans' === $name ? 1 : 2;
45
        $domain = 'messages';
46
        $arguments = $node->getNode('arguments');
47
        if ($arguments->hasNode($index)) {
48
            $argument = $arguments->getNode($index);
49
            if (!$argument instanceof \Twig_Node_Expression_Constant) {
50
                return $node;
51
            }
52
53
            $domain = $argument->getAttribute('value');
54
        }
55
56
        $source = new SourceLocation($id, $this->getAbsoluteFilePath(), $node->getLine(), ['domain' => $domain]);
57
        $this->collection->addLocation($source);

src/Visitor/Twig/Worker.php 1 location

@@ 120-126 (lines=7) @@
117
     */
118
    private function getReadDomainFromArguments(\Twig_Node $arguments, $index)
119
    {
120
        if ($arguments->hasNode('domain')) {
121
            $argument = $arguments->getNode('domain');
122
        } elseif ($arguments->hasNode($index)) {
123
            $argument = $arguments->getNode($index);
124
        } else {
125
            return self::UNDEFINED_DOMAIN;
126
        }
127
128
        return $this->getReadDomainFromNode($argument);
129
    }