Template Helper
This helper is used to build file templates from string TemplateHelper::fromString() or from a stub file TemplateHelper::fromFile().
Template Helper is "macroable", which allows you to add additional methods to the TemplateHelper class at run time.
Construct from File
/**
* Load template from file
* @param string $filename
* @return Template
* @throws \Exception
*/
TemplateHelper::fromFile(): voidConstruct from String
/**
* Load template from string
* @param string $string
* @return Template
*/
TemplateHelper::fromString(): voidReplace
/**
* Does the actual string replacing
* Expected input it keyed array of changes ("name:modifier" => content).
* It supports some content modifiers like: list, array and string.
* @param array $changes: keyed array, which supports modifiers
* @return Template
* @throws \Exception
*/
TemplateHelper::replace(): voidBuild to File
/**
* Write template output to file
* @param string $filepath
* @return string
* @throws \Exception
*/
TemplateHelper::toFile(): voidBuild to String
/**
* Output template
* @return string
* @throws \Exception
*/
TemplateHelper::toString(): voidList
/**
* Build an list string from an array or Collection
* @param array|Collection $value
* @return string
*/
TemplateHelper::list(): voidArray
/**
* Build an array string from an array or Collection
* @param array|Collection $value
* @return string
*/
TemplateHelper::array(): voidString
/**
* Build an escaped string
* @param string $value
* @return string
*/
TemplateHelper::string(): voidInteger
/**
* Build an integer from value
* @param int|string $value
* @return int
*/
TemplateHelper::integer(): void