summaryrefslogtreecommitdiff
path: root/src/Compile/Modifier/StringFormatModifierCompiler.php
blob: a0c23ae520db34bf5a9e522fea57cb0806ac04b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
namespace Smarty\Compile\Modifier;
/**
 * Smarty string_format modifier plugin
 * Type:     modifier
 * Name:     string_format
 * Purpose:  format strings via sprintf
 *
 * @link   https://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
 * @author Uwe Tews
 */

class StringFormatModifierCompiler extends Base {

	public function compile($params, \Smarty\Compiler\Template $compiler) {
		return 'sprintf(' . $params[ 1 ] . ',' . $params[ 0 ] . ')';
	}

}