protected _paths ( string $type, array $params ) : string | ||
$type | string | |
$params | array | The set of options keys to be interpolated into the path templates when searching for the correct file to load. |
Résultat | string | Returns the first template file found. Throws an exception if no templates are available. |
protected function _paths($type, array $params)
{
if (!isset($this->_paths[$type])) {
throw new TemplateException("Invalid template type '{$type}'.");
}
foreach ((array) $this->_paths[$type] as $path) {
if (!file_exists($path = String::insert($path, $params))) {
continue;
}
return $path;
}
throw new TemplateException("Template not found at path `{$path}`.");
}