aboutsummaryrefslogtreecommitdiff
path: root/lib/exTpl/ConstantExpression.php
blob: 72356473a6e8ef481f4f33208f58e4632f1a31a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace exTpl;

/**
 * ConstantExpression represents a literal value.
 */
class ConstantExpression implements Expression
{
    protected mixed $value;

    /**
     * Initializes a new Expression instance.
     *
     * @param mixed $value expression value
     */
    public function __construct(mixed $value)
    {
        $this->value = $value;
    }

    /**
     * Returns the value of this expression.
     *
     * @param Context $context symbol table
     */
    public function value(Context $context): mixed
    {
        return $this->value;
    }
}