clean up Tokenizer->scan -- add error annotation, spaces between +, strict type checking, and self instead of Mustache_Tokenizer

This commit is contained in:
steve
2014-06-19 11:29:21 -07:00
parent 40e86247ad
commit 842b31b477
+4 -2
View File
@@ -84,6 +84,8 @@ class Mustache_Tokenizer
/**
* Scan and tokenize template source.
*
* @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered.
*
* @param string $text Mustache template source to tokenize
* @param string $delimiters Optionally, pass initial opening and closing delimiters (default: null)
*
@@ -163,12 +165,12 @@ class Mustache_Tokenizer
if ($this->tagType === self::T_UNESCAPED) {
// Clean up `{{{ tripleStache }}}` style tokens.
if ($this->ctag === '}}') {
if (($i+2 < $len) && $text[$i+2] == '}') {
if (($i+2 < $len) && $text[$i + 2] === '}') {
$i++;
} else {
$msg = sprintf(
'Uneven closing tag encountered: on line %d',
$token[Mustache_Tokenizer::LINE]
$token[self::LINE]
);
throw new Mustache_Exception_SyntaxException($msg, $token);