CS update
This commit is contained in:
@@ -12,9 +12,4 @@ $config = Config::create()
|
|||||||
$finder = $config->getFinder()
|
$finder = $config->getFinder()
|
||||||
->in(__DIR__);
|
->in(__DIR__);
|
||||||
|
|
||||||
// exclude file due to error on PHP 5.3 that ignore content after __halt_compiler when using token_get_all
|
|
||||||
if (version_compare(PHP_VERSION, '5.4', '<')) {
|
|
||||||
$finder->notPath('test/Mustache/Test/Loader/InlineLoaderTest.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'
|
|||||||
*/
|
*/
|
||||||
function getLowerCaseName($name)
|
function getLowerCaseName($name)
|
||||||
{
|
{
|
||||||
return preg_replace_callback("/([A-Z])/", create_function(
|
return preg_replace_callback('/([A-Z])/', create_function(
|
||||||
'$match',
|
'$match',
|
||||||
'return "_" . strtolower($match[1]);'
|
'return "_" . strtolower($match[1]);'
|
||||||
), lcfirst($name));
|
), lcfirst($name));
|
||||||
@@ -62,7 +62,7 @@ function getLowerCaseName($name)
|
|||||||
*/
|
*/
|
||||||
function getUpperCaseName($name)
|
function getUpperCaseName($name)
|
||||||
{
|
{
|
||||||
return preg_replace_callback("/_([a-z])/", create_function(
|
return preg_replace_callback('/_([a-z])/', create_function(
|
||||||
'$match',
|
'$match',
|
||||||
'return strtoupper($match{1});'
|
'return strtoupper($match{1});'
|
||||||
), ucfirst($name));
|
), ucfirst($name));
|
||||||
@@ -100,7 +100,7 @@ function out($value)
|
|||||||
function buildPath($directory, $filename = null, $extension = null)
|
function buildPath($directory, $filename = null, $extension = null)
|
||||||
{
|
{
|
||||||
return out(EXAMPLE_PATH . '/' . $directory .
|
return out(EXAMPLE_PATH . '/' . $directory .
|
||||||
($extension !== null && $filename !== null ? '/' . $filename . "." . $extension : ""));
|
($extension !== null && $filename !== null ? '/' . $filename . '.' . $extension : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,9 +129,9 @@ function createDirectory($directory)
|
|||||||
* @param string $content the content of the file
|
* @param string $content the content of the file
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function createFile($directory, $filename, $extension, $content = "")
|
function createFile($directory, $filename, $extension, $content = '')
|
||||||
{
|
{
|
||||||
$handle = @fopen(buildPath($directory, $filename, $extension), "w");
|
$handle = @fopen(buildPath($directory, $filename, $extension), 'w');
|
||||||
if ($handle) {
|
if ($handle) {
|
||||||
fwrite($handle, $content);
|
fwrite($handle, $content);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
@@ -157,9 +157,9 @@ function main($example_name)
|
|||||||
$lowercase = getLowerCaseName($example_name);
|
$lowercase = getLowerCaseName($example_name);
|
||||||
$uppercase = getUpperCaseName($example_name);
|
$uppercase = getUpperCaseName($example_name);
|
||||||
createDirectory($lowercase);
|
createDirectory($lowercase);
|
||||||
createFile($lowercase, $lowercase, "mustache");
|
createFile($lowercase, $lowercase, 'mustache');
|
||||||
createFile($lowercase, $lowercase, "txt");
|
createFile($lowercase, $lowercase, 'txt');
|
||||||
createFile($lowercase, $uppercase, "php", <<<CONTENT
|
createFile($lowercase, $uppercase, 'php', <<<CONTENT
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class {$uppercase} {
|
class {$uppercase} {
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~3.7|~4.0",
|
"phpunit/phpunit": "~3.7|~4.0",
|
||||||
"fabpot/php-cs-fixer": "~1.3"
|
"fabpot/php-cs-fixer": "~1.6"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": { "Mustache": "src/" }
|
"psr-0": { "Mustache": "src/" }
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ interface Mustache_Cache
|
|||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return boolean indicates successfully class load
|
* @return bool indicates successfully class load
|
||||||
*/
|
*/
|
||||||
public function load($key);
|
public function load($key);
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ abstract class Mustache_Cache_AbstractCache implements Mustache_Cache
|
|||||||
/**
|
/**
|
||||||
* Add a log record if logging is enabled.
|
* Add a log record if logging is enabled.
|
||||||
*
|
*
|
||||||
* @param integer $level The logging level
|
* @param int $level The logging level
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function load($key)
|
public function load($key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
|
|||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function load($key)
|
public function load($key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ class Mustache_Compiler
|
|||||||
*
|
*
|
||||||
* @param array $node
|
* @param array $node
|
||||||
*
|
*
|
||||||
* @return boolean True if $node is a block arg token.
|
* @return bool True if $node is a block arg token.
|
||||||
*/
|
*/
|
||||||
private static function onlyBlockArgs(array $node)
|
private static function onlyBlockArgs(array $node)
|
||||||
{
|
{
|
||||||
@@ -474,7 +474,7 @@ class Mustache_Compiler
|
|||||||
*
|
*
|
||||||
* @param string $id Variable name
|
* @param string $id Variable name
|
||||||
* @param string[] $filters Array of filters
|
* @param string[] $filters Array of filters
|
||||||
* @param boolean $escape Escape the variable value for output?
|
* @param bool $escape Escape the variable value for output?
|
||||||
* @param int $level
|
* @param int $level
|
||||||
*
|
*
|
||||||
* @return string Generated variable interpolation PHP source
|
* @return string Generated variable interpolation PHP source
|
||||||
@@ -545,8 +545,8 @@ class Mustache_Compiler
|
|||||||
*
|
*
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param int $bonus Additional indent level (default: 0)
|
* @param int $bonus Additional indent level (default: 0)
|
||||||
* @param boolean $prependNewline Prepend a newline to the snippet? (default: true)
|
* @param bool $prependNewline Prepend a newline to the snippet? (default: true)
|
||||||
* @param boolean $appendNewline Append a newline to the snippet? (default: false)
|
* @param bool $appendNewline Append a newline to the snippet? (default: false)
|
||||||
*
|
*
|
||||||
* @return string PHP source code snippet
|
* @return string PHP source code snippet
|
||||||
*/
|
*/
|
||||||
@@ -560,7 +560,7 @@ class Mustache_Compiler
|
|||||||
$text .= "\n";
|
$text .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return preg_replace("/\n( {8})?/", "\n" . str_repeat(" ", $bonus * 4), $text);
|
return preg_replace("/\n( {8})?/", "\n" . str_repeat(' ', $bonus * 4), $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)';
|
const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)';
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ class Mustache_Engine
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return boolean True if the helper is present
|
* @return bool True if the helper is present
|
||||||
*/
|
*/
|
||||||
public function hasHelper($name)
|
public function hasHelper($name)
|
||||||
{
|
{
|
||||||
@@ -772,7 +772,7 @@ class Mustache_Engine
|
|||||||
/**
|
/**
|
||||||
* Add a log record if logging is enabled.
|
* Add a log record if logging is enabled.
|
||||||
*
|
*
|
||||||
* @param integer $level The logging level
|
* @param int $level The logging level
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class Mustache_HelperCollection
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return boolean True if helper is present
|
* @return bool True if helper is present
|
||||||
*/
|
*/
|
||||||
public function __isset($name)
|
public function __isset($name)
|
||||||
{
|
{
|
||||||
@@ -115,7 +115,7 @@ class Mustache_HelperCollection
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return boolean True if helper is present
|
* @return bool True if helper is present
|
||||||
*/
|
*/
|
||||||
public function has($name)
|
public function has($name)
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ class Mustache_HelperCollection
|
|||||||
/**
|
/**
|
||||||
* Check whether the helper collection is empty.
|
* Check whether the helper collection is empty.
|
||||||
*
|
*
|
||||||
* @return boolean True if the collection is empty
|
* @return bool True if the collection is empty
|
||||||
*/
|
*/
|
||||||
public function isEmpty()
|
public function isEmpty()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|||||||
* @throws InvalidArgumentException if the logging level is unknown.
|
* @throws InvalidArgumentException if the logging level is unknown.
|
||||||
*
|
*
|
||||||
* @param resource|string $stream Resource instance or URL
|
* @param resource|string $stream Resource instance or URL
|
||||||
* @param integer $level The minimum logging level at which this handler will be triggered
|
* @param int $level The minimum logging level at which this handler will be triggered
|
||||||
*/
|
*/
|
||||||
public function __construct($stream, $level = Mustache_Logger::ERROR)
|
public function __construct($stream, $level = Mustache_Logger::ERROR)
|
||||||
{
|
{
|
||||||
@@ -67,7 +67,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|||||||
*
|
*
|
||||||
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
|
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown.
|
||||||
*
|
*
|
||||||
* @param integer $level The minimum logging level which will be written
|
* @param int $level The minimum logging level which will be written
|
||||||
*/
|
*/
|
||||||
public function setLevel($level)
|
public function setLevel($level)
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|||||||
/**
|
/**
|
||||||
* Get the current minimum logging level.
|
* Get the current minimum logging level.
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getLevel()
|
public function getLevel()
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|||||||
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present.
|
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present.
|
||||||
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened.
|
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened.
|
||||||
*
|
*
|
||||||
* @param integer $level The logging level
|
* @param int $level The logging level
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
@@ -141,7 +141,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|||||||
*
|
*
|
||||||
* @throws InvalidArgumentException if the logging level is unknown.
|
* @throws InvalidArgumentException if the logging level is unknown.
|
||||||
*
|
*
|
||||||
* @param integer $level
|
* @param int $level
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -153,7 +153,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|||||||
/**
|
/**
|
||||||
* Format a log line for output.
|
* Format a log line for output.
|
||||||
*
|
*
|
||||||
* @param integer $level The logging level
|
* @param int $level The logging level
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class Mustache_Parser
|
|||||||
*
|
*
|
||||||
* @param array $token
|
* @param array $token
|
||||||
*
|
*
|
||||||
* @return boolean True if token is a whitespace token
|
* @return bool True if token is a whitespace token
|
||||||
*/
|
*/
|
||||||
private function tokenIsWhitespace(array $token)
|
private function tokenIsWhitespace(array $token)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ abstract class Mustache_Template
|
|||||||
protected $mustache;
|
protected $mustache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $strictCallables = false;
|
protected $strictCallables = false;
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ abstract class Mustache_Template
|
|||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*
|
*
|
||||||
* @return boolean True if the value is 'iterable'
|
* @return bool True if the value is 'iterable'
|
||||||
*/
|
*/
|
||||||
protected function isIterable($value)
|
protected function isIterable($value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ class Mustache_Tokenizer
|
|||||||
* @param string $text Mustache template source
|
* @param string $text Mustache template source
|
||||||
* @param int $index Current tokenizer index
|
* @param int $index Current tokenizer index
|
||||||
*
|
*
|
||||||
* @return boolean True if this is a closing section tag
|
* @return bool True if this is a closing section tag
|
||||||
*/
|
*/
|
||||||
private function tagChange($tag, $tagLen, $text, $index)
|
private function tagChange($tag, $tagLen, $text, $index)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
|||||||
list($name, $mustache) = $this->getLoggedMustache(Mustache_Logger::DEBUG);
|
list($name, $mustache) = $this->getLoggedMustache(Mustache_Logger::DEBUG);
|
||||||
$mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO'));
|
$mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO'));
|
||||||
$log = file_get_contents($name);
|
$log = file_get_contents($name);
|
||||||
$this->assertContains("DEBUG: Instantiating template: ", $log);
|
$this->assertContains('DEBUG: Instantiating template: ', $log);
|
||||||
$this->assertContains("WARNING: Partial not found: \"bar\"", $log);
|
$this->assertContains("WARNING: Partial not found: \"bar\"", $log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
|||||||
array(
|
array(
|
||||||
'{{% FILTERS }}{{ date | longdate }}',
|
'{{% FILTERS }}{{ date | longdate }}',
|
||||||
$helpers,
|
$helpers,
|
||||||
(object) array('date' => new DateTime('1/1/2000', new DateTimeZone("UTC"))),
|
(object) array('date' => new DateTime('1/1/2000', new DateTimeZone('UTC'))),
|
||||||
'2000-01-01 12:01:00',
|
'2000-01-01 12:01:00',
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
|||||||
});
|
});
|
||||||
|
|
||||||
$foo = new \StdClass();
|
$foo = new \StdClass();
|
||||||
$foo->date = new DateTime('1/1/2000', new DateTimeZone("UTC"));
|
$foo->date = new DateTime('1/1/2000', new DateTimeZone('UTC'));
|
||||||
|
|
||||||
$this->assertEquals('[[2000-01-01 12:01:00]]', $tpl->render($foo));
|
$this->assertEquals('[[2000-01-01 12:01:00]]', $tpl->render($foo));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$stream = tmpfile();
|
$stream = tmpfile();
|
||||||
$logger = new Mustache_Logger_StreamLogger($stream, $logLevel);
|
$logger = new Mustache_Logger_StreamLogger($stream, $logLevel);
|
||||||
$logger->log($level, "logged");
|
$logger->log($level, 'logged');
|
||||||
|
|
||||||
rewind($stream);
|
rewind($stream);
|
||||||
$result = fread($stream, 1024);
|
$result = fread($stream, 1024);
|
||||||
|
|
||||||
if ($shouldLog) {
|
if ($shouldLog) {
|
||||||
$this->assertContains("logged", $result);
|
$this->assertContains('logged', $result);
|
||||||
} else {
|
} else {
|
||||||
$this->assertEmpty($result);
|
$this->assertEmpty($result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::VALUE => " ",
|
Mustache_Tokenizer::VALUE => ' ',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_DELIM_CHANGE,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_DELIM_CHANGE,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$tokenizer = new Mustache_Tokenizer();
|
$tokenizer = new Mustache_Tokenizer();
|
||||||
|
|
||||||
$text = "{{{ name }}";
|
$text = '{{{ name }}';
|
||||||
$tokenizer->scan($text, null);
|
$tokenizer->scan($text, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,8 +41,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$tokenizer = new Mustache_Tokenizer();
|
$tokenizer = new Mustache_Tokenizer();
|
||||||
|
|
||||||
$text = "<%{ name %>";
|
$text = '<%{ name %>';
|
||||||
$tokenizer->scan($text, "<% %>");
|
$tokenizer->scan($text, '<% %>');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTokens()
|
public function getTokens()
|
||||||
@@ -183,7 +183,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// See https://github.com/bobthecow/mustache.php/issues/183
|
// See https://github.com/bobthecow/mustache.php/issues/183
|
||||||
array(
|
array(
|
||||||
"{{# a }}0{{/ a }}",
|
'{{# a }}0{{/ a }}',
|
||||||
null,
|
null,
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
@@ -197,7 +197,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::VALUE => "0",
|
Mustache_Tokenizer::VALUE => '0',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
@@ -212,8 +212,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// custom delimiters don't swallow the next character, even if it is a }, }}}, or the same delimiter
|
// custom delimiters don't swallow the next character, even if it is a }, }}}, or the same delimiter
|
||||||
array(
|
array(
|
||||||
"<% a %>} <% b %>%> <% c %>}}}",
|
'<% a %>} <% b %>%> <% c %>}}}',
|
||||||
"<% %>",
|
'<% %>',
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
@@ -226,7 +226,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::VALUE => "} ",
|
Mustache_Tokenizer::VALUE => '} ',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
@@ -239,7 +239,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::VALUE => "%> ",
|
Mustache_Tokenizer::VALUE => '%> ',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
@@ -252,15 +252,15 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::VALUE => "}}}",
|
Mustache_Tokenizer::VALUE => '}}}',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// unescaped custom delimiters are properly parsed
|
// unescaped custom delimiters are properly parsed
|
||||||
array(
|
array(
|
||||||
"<%{ a }%>",
|
'<%{ a }%>',
|
||||||
"<% %>",
|
'<% %>',
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
||||||
@@ -289,7 +289,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::VALUE => "default",
|
Mustache_Tokenizer::VALUE => 'default',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
|
|||||||
+4
-4
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
class Delimiters
|
class Delimiters
|
||||||
{
|
{
|
||||||
public $start = "It worked the first time.";
|
public $start = 'It worked the first time.';
|
||||||
|
|
||||||
public function middle()
|
public function middle()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('item' => "And it worked the second time."),
|
array('item' => 'And it worked the second time.'),
|
||||||
array('item' => "As well as the third."),
|
array('item' => 'As well as the third.'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public $final = "Then, surprisingly, it worked the final time.";
|
public $final = 'Then, surprisingly, it worked the final time.';
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,5 +7,5 @@ class DoubleSection
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public $two = "second";
|
public $two = 'second';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class SectionIteratorObjects
|
class SectionIteratorObjects
|
||||||
{
|
{
|
||||||
public $start = "It worked the first time.";
|
public $start = 'It worked the first time.';
|
||||||
|
|
||||||
protected $_data = array(
|
protected $_data = array(
|
||||||
array('item' => 'And it worked the second time.'),
|
array('item' => 'And it worked the second time.'),
|
||||||
@@ -14,5 +14,5 @@ class SectionIteratorObjects
|
|||||||
return new ArrayIterator($this->_data);
|
return new ArrayIterator($this->_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public $final = "Then, surprisingly, it worked the final time.";
|
public $final = 'Then, surprisingly, it worked the final time.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
class SectionMagicObjects
|
class SectionMagicObjects
|
||||||
{
|
{
|
||||||
public $start = "It worked the first time.";
|
public $start = 'It worked the first time.';
|
||||||
|
|
||||||
public function middle()
|
public function middle()
|
||||||
{
|
{
|
||||||
return new MagicObject();
|
return new MagicObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public $final = "Then, surprisingly, it worked the final time.";
|
public $final = 'Then, surprisingly, it worked the final time.';
|
||||||
}
|
}
|
||||||
|
|
||||||
class MagicObject
|
class MagicObject
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
class SectionObjects
|
class SectionObjects
|
||||||
{
|
{
|
||||||
public $start = "It worked the first time.";
|
public $start = 'It worked the first time.';
|
||||||
|
|
||||||
public function middle()
|
public function middle()
|
||||||
{
|
{
|
||||||
return new SectionObject();
|
return new SectionObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public $final = "Then, surprisingly, it worked the final time.";
|
public $final = 'Then, surprisingly, it worked the final time.';
|
||||||
}
|
}
|
||||||
|
|
||||||
class SectionObject
|
class SectionObject
|
||||||
|
|||||||
+4
-4
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
class Sections
|
class Sections
|
||||||
{
|
{
|
||||||
public $start = "It worked the first time.";
|
public $start = 'It worked the first time.';
|
||||||
|
|
||||||
public function middle()
|
public function middle()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('item' => "And it worked the second time."),
|
array('item' => 'And it worked the second time.'),
|
||||||
array('item' => "As well as the third."),
|
array('item' => 'As well as the third.'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public $final = "Then, surprisingly, it worked the final time.";
|
public $final = 'Then, surprisingly, it worked the final time.';
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class Simple
|
class Simple
|
||||||
{
|
{
|
||||||
public $name = "Chris";
|
public $name = 'Chris';
|
||||||
public $value = 10000;
|
public $value = 10000;
|
||||||
|
|
||||||
public function taxed_value()
|
public function taxed_value()
|
||||||
|
|||||||
+1
-1
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
class Unescaped
|
class Unescaped
|
||||||
{
|
{
|
||||||
public $title = "Bear > Shark";
|
public $title = 'Bear > Shark';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user