From cf76a4b8f908507e6a5e25b9ccf3e5106e69a032 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 26 Jan 2013 14:49:14 -0800 Subject: [PATCH] Remove unused `escape` param from `renderInternal` --- src/Mustache/Compiler.php | 18 +++++------------- src/Mustache/Template.php | 5 +++-- test/Mustache/Test/CompilerTest.php | 4 ---- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index f7f1d31..e35f6f7 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -126,17 +126,13 @@ class Mustache_Compiler { private $lambdaHelper; - public function renderInternal(Mustache_Context $context, $indent = \'\', $escape = false) + public function renderInternal(Mustache_Context $context, $indent = \'\') { $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context); $buffer = \'\'; %s - if ($escape) { - return %s; - } else { - return $buffer; - } + return $buffer; } %s }'; @@ -145,16 +141,12 @@ class Mustache_Compiler class %s extends Mustache_Template { - public function renderInternal(Mustache_Context $context, $indent = \'\', $escape = false) + public function renderInternal(Mustache_Context $context, $indent = \'\') { $buffer = \'\'; %s - if ($escape) { - return %s; - } else { - return $buffer; - } + return $buffer; } %s }'; @@ -173,7 +165,7 @@ class Mustache_Compiler $sections = implode("\n", $this->sections); $klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS; - return sprintf($this->prepare($klass, 0, false), $name, $code, $this->getEscape('$buffer'), $sections); + return sprintf($this->prepare($klass, 0, false), $name, $code, $sections); } const SECTION_CALL = ' diff --git a/src/Mustache/Template.php b/src/Mustache/Template.php index b9c81fd..b3d57ed 100644 --- a/src/Mustache/Template.php +++ b/src/Mustache/Template.php @@ -67,13 +67,14 @@ abstract class Mustache_Template * * This is where the magic happens :) * + * NOTE: This method is not part of the Mustache.php public API. + * * @param Mustache_Context $context * @param string $indent (default: '') - * @param bool $escape (default: false) * * @return string Rendered template */ - abstract public function renderInternal(Mustache_Context $context, $indent = '', $escape = false); + abstract public function renderInternal(Mustache_Context $context, $indent = ''); /** * Tests whether a value should be iterated over (e.g. in a section context). diff --git a/test/Mustache/Test/CompilerTest.php b/test/Mustache/Test/CompilerTest.php index c952e0c..a94a3f3 100644 --- a/test/Mustache/Test/CompilerTest.php +++ b/test/Mustache/Test/CompilerTest.php @@ -33,13 +33,11 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase return array( array('', array(), 'Banana', false, 'ISO-8859-1', array( "\nclass Banana extends Mustache_Template", - 'return htmlspecialchars($buffer, ENT_COMPAT, \'ISO-8859-1\');', 'return $buffer;', )), array('', array($this->createTextToken('TEXT')), 'Monkey', false, 'UTF-8', array( "\nclass Monkey extends Mustache_Template", - 'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');', '$buffer .= $indent . \'TEXT\';', 'return $buffer;', )), @@ -47,7 +45,6 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase array('', array($this->createTextToken('TEXT')), 'Monkey', true, 'ISO-8859-1', array( "\nclass Monkey extends Mustache_Template", '$buffer .= $indent . \'TEXT\';', - 'return call_user_func($this->mustache->getEscape(), $buffer);', 'return $buffer;', )), @@ -77,7 +74,6 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase '$buffer .= htmlspecialchars($value, ENT_COMPAT, \'UTF-8\');', '$value = $context->last();', '$buffer .= \'\\\'bar\\\'\';', - 'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');', 'return $buffer;', ) ),