/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/View
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/View/StringTemplateTrait.php (2839B)
templater()->add($templates);
return $this;
}
/**
* Gets templates to use or a specific template.
*
* @param string|null $template String for reading a specific template, null for all.
* @return string|array
*/
public function getTemplates(?string $template = null)
{
return $this->templater()->get($template);
}
/**
* Formats a template string with $data
*
* @param string $name The template name.
* @param array $data The data to insert.
* @return string
*/
public function formatTemplate(string $name, array $data): string
{
return $this->templater()->format($name, $data);
}
/**
* Returns the templater instance.
*
* @return \Cake\View\StringTemplate
*/
public function templater(): StringTemplate
{
if ($this->_templater === null) {
/** @var class-string<\Cake\View\StringTemplate> $class */
$class = $this->getConfig('templateClass') ?: StringTemplate::class;
$this->_templater = new $class();
$templates = $this->getConfig('templates');
if ($templates) {
if (is_string($templates)) {
$this->_templater->add($this->_defaultConfig['templates']);
$this->_templater->load($templates);
} else {
$this->_templater->add($templates);
}
}
}
return $this->_templater;
}
}