nur-sery/nur_src/interp.php

29 lines
738 B
PHP
Raw Permalink Normal View History

2023-12-03 22:10:18 +04:00
<?php
namespace nur;
use nur\data\template\InterpTemplate;
/**
* Class templ: interface simplifiée pour évaluer des templates
*/
class interp {
/** @var InterpTemplate */
private static $t;
2024-10-04 14:22:43 +04:00
private static function t(): InterpTemplate {
2023-12-03 22:10:18 +04:00
if (self::$t === null) self::$t = new InterpTemplate();
return self::$t;
}
static final function xml(?string $text, $data, $quote=null, bool $allow_pattern=true): string {
return self::t()->xml($text, $data, $quote, $allow_pattern);
}
static final function string(?string $text, $data): string {
return self::t()->string($text, $data);
}
static final function odt(string $file, $data=null, $quote=true): void {
self::t()->odt($file, $data, $quote);
}
}