<?php
 class vB_Utility_Template_ParserNode_Curly_Raw extends vB_Utility_Template_ParserNode_Curly { public function validate() : array { $errors = []; $attributecount = sizeof($this->main_node->attributes); if ($attributecount == 0) { $errors[] = ['no_variable_specified']; } else { $attribute = $this->main_node->attributes[0]; if (is_string($attribute)) { if (strpos($attribute, '(') !== false) { throw new vB_Utility_Template_Parser_FatalError('template_text_not_safe'); } else if (!preg_match('#\$?([a-z_][a-z0-9_]*)(\.([a-z0-9_]+|\$([a-z_][a-z0-9_]*))+)*#i', $attribute)) { $errors[] = ['invalid_variable_name']; } } else { $errors[] = ['invalid_variable_name']; } } return $errors; } public function compile() : string { if (is_string($this->main_node->attributes[0])) { $output = $this->compileVar($this->main_node->attributes[0]); if (!$this->main_node->refParam) { $output = '(' . $output . " ?? null)"; } } else { $output = "''"; } return $output; } } 