FilterExpression example

$visitor = new TranslationNodeVisitor();
        $visitor->enable();
        $visitor->enterNode($node$env);
        $visitor->leaveNode($node$env);
        $this->assertEquals($expectedMessages$visitor->getMessages());
    }

    public function testMessageExtractionWithInvalidDomainNode()
    {
        $message = 'new key';

        $node = new FilterExpression(
            new ConstantExpression($message, 0),
            new ConstantExpression('trans', 0),
            new Node([
                new ArrayExpression([], 0),
                new NameExpression('variable', 0),
            ]),
            0
        );

        $this->testMessagesExtraction($node[[$message, TranslationNodeVisitor::UNDEFINED_DOMAIN]]);
    }

    


    public static function getTransFilter($message$domain = null, $arguments = null)
    {
        if (!$arguments) {
            $arguments = $domain ? [
                new ArrayExpression([], 0),
                new ConstantExpression($domain, 0),
            ] : [];
        }

        return new FilterExpression(
            new ConstantExpression($message, 0),
            new ConstantExpression('trans', 0),
            new Node($arguments),
            0
        );
    }

    public static function getTransTag($message$domain = null)
    {
        return new TransNode(
            new BodyNode([]['data' => $message]),
            
Home | Imprint | This part of the site doesn't use cookies.