methode zum unique teile rendern hinzugefügt
This commit is contained in:
parent
e8bb01844e
commit
9dae115ad4
|
@ -263,4 +263,19 @@ class StringBuilder {
|
|||
}
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Teile zu einem String zusammenfügen, wärend doppelt vorkommende Teile nicht erneut vorkommen und dann variablen im gesamt String ersetzen.
|
||||
* @return string Gesamt-String mit Variablen ersetzt.
|
||||
*/
|
||||
public function renderUnique() : string {
|
||||
$tpl = $this->joinUnique();
|
||||
foreach($this->vars as $key => $value) {
|
||||
if(is_numeric($value) or is_string($value)) {
|
||||
$tpl = preg_replace("/".$this->varPrefix."\s*".$key."\s*".$this->varSuffix."/", $value, $tpl);
|
||||
}
|
||||
}
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue