Skip to content
Snippets Groups Projects
Select Git revision
  • 15c29abc3dc12e40c40a9331f6b9478386d2bf7d
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

ExpressionNode.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ExpressionNode.php 764 B
    <?php
    
    namespace exTpl;
    
    /**
     * ExpressionNode represents an expression tag: "{...}".
     */
    class ExpressionNode implements Node
    {
        protected Expression $expr;
    
        /**
         * Initializes a new Node instance with the given expression.
         *
         * @param Expression $expr expression object
         */
        public function __construct(Expression $expr)
        {
            $this->expr = $expr;
        }
    
        /**
         * Returns a string representation of this node.
         *
         * @param Context $context symbol table
         */
        public function render(Context $context): ?string
        {
            $value = $this->expr->value($context);
    
            if (!($this->expr instanceof RawExpression)) {
                $value = $context->escape($value);
            }
    
            return $value;
        }
    }