Code Duplication    Length = 7-8 lines in 2 locations

src/Visitor/Twig/Worker.php 1 location

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

src/Visitor/Twig/WorkerTranslationFilter.php 1 location

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