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..)

Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Arguments

$text

string

A string containing the template to be replaced

Response

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

The constructed TextTemplateObject

TODO

getText()
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

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

replace(string $keyword,string $replacement)
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

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