From c39d8fbcbeb07a0948d5e1cf8d78c6e1ef3e81a8 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Tue, 21 Oct 2014 08:06:12 -0400 Subject: [PATCH] Clean up new batch functionality in escaping functions. --- src/Template/Template.php | 16 ++++++++-------- tests/Template/TemplateTest.php | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Template/Template.php b/src/Template/Template.php index c62be1ce..8a3622f6 100644 --- a/src/Template/Template.php +++ b/src/Template/Template.php @@ -263,15 +263,14 @@ protected function batch($var, $functions) /** * Escape string. - * @param string $string + * @param string $string + * @param null|string $functions * @return string */ - protected function escape($string) + protected function escape($string, $functions = null) { - $functions = array_slice(func_get_args(), 1); - if ($functions) { - $string = $this->batch($string, implode('|', $functions)); + $string = $this->batch($string, $functions); } return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); @@ -279,12 +278,13 @@ protected function escape($string) /** * Alias to escape function. - * @param string $string + * @param string $string + * @param null|string $functions * @return string */ - protected function e($string) + protected function e($string, $functions = null) { - return call_user_func_array(array($this, 'escape'), func_get_args()); + return $this->escape($string, $functions); } } diff --git a/tests/Template/TemplateTest.php b/tests/Template/TemplateTest.php index 0a195c51..229b9d13 100644 --- a/tests/Template/TemplateTest.php +++ b/tests/Template/TemplateTest.php @@ -229,7 +229,7 @@ public function testEscapeFunctionBatch() { vfsStream::create( array( - 'template.php' => 'escape("Jonathan", "strtoupper", "strrev") ?>' + 'template.php' => 'escape("Jonathan", "strtoupper|strrev") ?>' ) );