Skip to content

Commit c39d8fb

Browse files
committed
Clean up new batch functionality in escaping functions.
1 parent 10ce61b commit c39d8fb

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Template/Template.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -263,28 +263,28 @@ protected function batch($var, $functions)
263263

264264
/**
265265
* Escape string.
266-
* @param string $string
266+
* @param string $string
267+
* @param null|string $functions
267268
* @return string
268269
*/
269-
protected function escape($string)
270+
protected function escape($string, $functions = null)
270271
{
271-
$functions = array_slice(func_get_args(), 1);
272-
273272
if ($functions) {
274-
$string = $this->batch($string, implode('|', $functions));
273+
$string = $this->batch($string, $functions);
275274
}
276275

277276
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
278277
}
279278

280279
/**
281280
* Alias to escape function.
282-
* @param string $string
281+
* @param string $string
282+
* @param null|string $functions
283283
* @return string
284284
*/
285-
protected function e($string)
285+
protected function e($string, $functions = null)
286286
{
287-
return call_user_func_array(array($this, 'escape'), func_get_args());
287+
return $this->escape($string, $functions);
288288
}
289289
}
290290

tests/Template/TemplateTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function testEscapeFunctionBatch()
229229
{
230230
vfsStream::create(
231231
array(
232-
'template.php' => '<?php echo $this->escape("<strong>Jonathan</strong>", "strtoupper", "strrev") ?>'
232+
'template.php' => '<?php echo $this->escape("<strong>Jonathan</strong>", "strtoupper|strrev") ?>'
233233
)
234234
);
235235

0 commit comments

Comments
 (0)