nur-sery/nur_src/interp.php

29 lines
744 B
PHP

<?php
namespace nur;
use nur\data\template\InterpTemplate;
/**
* Class templ: interface simplifiée pour évaluer des templates
*/
class interp {
/** @var InterpTemplate */
private static $t;
private static final function t(): InterpTemplate {
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);
}
}