TextTemplateObject

Text template abstraction

package

Default

Methods

This object represents a predefined string that contains one or more keywords that need to be replaced at runtime.

__construct(string $text) : \org\turbocommons\src\main\php\model\TextTemplateObject

It contains all the most common operations that will help us with the replacement and get a ready to use result.

This kind of template object has lots of uses inside an application, but for example we could use it to send emails with predefined texts where some parts must be customized (like the receiver name or username, etc..)

Arguments

$text

string

A string containing the template to be replaced

Response

\org\turbocommons\src\main\php\model\TextTemplateObject

The constructed TextTemplateObject

TODO

getText() 

Replaces all the keyword occurences on the current template text with the specified value

replace(string $keyword, string $replacement) 

Arguments

$keyword

string

A value to find on the template text that will be replaced

$replacement

string

A value that will replace all the occurences of the specified keyword