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

@@ 87-93 (lines=7) @@
84
     */
85
    private function getReadDomainFromArguments(\Twig_Node $arguments, $index)
86
    {
87
        if ($arguments->hasNode('domain')) {
88
            $argument = $arguments->getNode('domain');
89
        } elseif ($arguments->hasNode($index)) {
90
            $argument = $arguments->getNode($index);
91
        } else {
92
            return self::UNDEFINED_DOMAIN;
93
        }
94
95
        return $this->getReadDomainFromNode($argument);
96
    }