1 | <?php |
||
18 | class ExpandedValue |
||
19 | { |
||
20 | /** |
||
21 | * Store the original value with variables and this value will be updated in-place as it's evaluated |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | private $evaluated; |
||
26 | |||
27 | /** |
||
28 | * The definition of variable replacements that occurred for this specific string |
||
29 | * |
||
30 | * The $key for the array would be the variable name without the % and the $value would be literal value that |
||
31 | * replaced the variable in the string |
||
32 | * |
||
33 | * @var string[] |
||
34 | */ |
||
35 | private $iterators; |
||
36 | |||
37 | /** |
||
38 | * ExpandedValue constructor. |
||
39 | * |
||
40 | * @param string $string |
||
41 | */ |
||
42 | 4 | public function __construct($string) |
|
46 | |||
47 | /** |
||
48 | * @return string |
||
49 | */ |
||
50 | 1 | public function __toString() |
|
54 | |||
55 | /** |
||
56 | * Get the current evaluated string |
||
57 | * |
||
58 | * If the evaluation in FrontMatterParser hasn't been completed, this will return the partially evaluated string |
||
59 | * variables still in place. |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | 4 | public function getEvaluated () |
|
67 | |||
68 | /** |
||
69 | * Update the currently evaluated string |
||
70 | * |
||
71 | * As the string is being evaluated in the FrontMatterParser, this value will be updated as variables are iterated |
||
72 | * through. |
||
73 | * |
||
74 | * @param string $string |
||
75 | */ |
||
76 | 3 | public function setEvaluated ($string) |
|
80 | |||
81 | /** |
||
82 | * Get all of the variable replacements that were used in this evaluated string |
||
83 | * |
||
84 | * @return string[] |
||
85 | */ |
||
86 | public function getIterators () |
||
87 | { |
||
88 | return $this->iterators; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Record the value of a variable replacement |
||
93 | * |
||
94 | * The variable name should NOT contain the % and the value should be as-is |
||
95 | * |
||
96 | * @param string $variableName |
||
97 | * @param string|int $variableValue |
||
98 | */ |
||
99 | 3 | public function setIterator ($variableName, $variableValue) |
|
103 | } |