<?php
 class vB_Utility_Template_ParserNode_Curly_Strrepeat extends vB_Utility_Template_ParserNode_Curly { public function validate() : array { $errors = []; $attributecount = sizeof($this->main_node->attributes); if ($attributecount == 0) { $errors[] = 'no_variable_specified'; } if ($attributecount < 2) { $errors[] = 'too_few_attributes'; } if ($attributecount > 2) { $errors[] = 'too_many_attributes'; } return $errors; } public function compile() : string { $var_name = $this->main_node->attributes[0]; if ($var_name instanceof vB_CurlyNode AND in_array($var_name->value, ['raw', 'var'])) { $string = $this->compileVar($var_name->attributes[0]); } else { $string = '$' . $var_name; } $value = $this->attributeToString($this->main_node->attributes[1]); return "''; $string = str_repeat($string, intval($value));" . ' $final_rendered .= \'\''; } } 