1: <?php
2:
3: namespace Deimos\Flow\Extension\TSimple;
4:
5: use Deimos\Flow\FlowFunction;
6:
7: class TAssign extends FlowFunction
8: {
9:
10: 11: 12:
13: protected $variable;
14:
15: 16: 17:
18: protected $value;
19:
20: 21: 22: 23: 24:
25: public function init()
26: {
27: array_shift($this->data);
28:
29: if (empty($this->data))
30: {
31: throw new \InvalidArgumentException('Assign not found variable name');
32: }
33:
34: $this->variable = array_shift($this->data);
35: array_shift($this->data);
36:
37: if (empty($this->data))
38: {
39: throw new \InvalidArgumentException('Assign not found variable value');
40: }
41:
42: $this->value = implode($this->data);
43: }
44:
45: 46: 47: 48: 49:
50: public function view()
51: {
52: $this->init();
53:
54: return '<?php $' . $this->variable . ' = ' . $this->value . '; ?>';
55: }
56:
57: }