File modules/template_engine/element/ValueExpression.class.php

Last commit: Sat Oct 3 00:50:14 2020 +0200	Jan Dankert	Fix: Show the rights of node objects.
1 <?php 2 3 namespace template_engine\element; 4 5 class ValueExpression 6 { 7 8 public $type; 9 public $name; 10 public $position; 11 12 const TYPE_DATA_VAR = 1; 13 const TYPE_MESSAGE = 2; 14 const TYPE_CONFIG = 3; 15 16 /** 17 * ValueExpression constructor. 18 * @param $type 19 * @param $name 20 * @param $position 21 */ 22 public function __construct($type, $name, $position) 23 { 24 $this->type = $type; 25 $this->name = $name; 26 $this->position = $position; 27 } 28 29 public function getAsString() { 30 switch($this->type) { 31 case ValueExpression::TYPE_CONFIG: 32 $ns = 'config:'; 33 break; 34 case ValueExpression::TYPE_MESSAGE: 35 $ns = 'message:'; 36 break; 37 case ValueExpression::TYPE_DATA_VAR: 38 default: 39 $ns = ''; 40 break; 41 } 42 return '$'.'{' . $ns . $this->name . '}'; 43 } 44 45 }
Download modules/template_engine/element/ValueExpression.class.php
History Sat, 3 Oct 2020 00:50:14 +0200 Jan Dankert Fix: Show the rights of node objects. Sat, 16 May 2020 01:08:40 +0200 Jan Dankert Refactoring: Switching the ValueExpressions in the templates to the new VariableResolver for supporting nested variables like ${message:prefix_${key}}. Thu, 27 Feb 2020 22:30:13 +0100 Jan Dankert New: ValueExpressions are able to contain other Value objects. Now data-driven messages are possible again :) Sat, 22 Feb 2020 22:23:01 +0100 Jan Dankert Refactoring: Enable Autoloading, Fix namespace structure.