aboutsummaryrefslogtreecommitdiff
path: root/lib/exTpl/ConstantExpression.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/exTpl/ConstantExpression.php')
-rw-r--r--lib/exTpl/ConstantExpression.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/exTpl/ConstantExpression.php b/lib/exTpl/ConstantExpression.php
new file mode 100644
index 0000000..7235647
--- /dev/null
+++ b/lib/exTpl/ConstantExpression.php
@@ -0,0 +1,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;
+ }
+}