Merge branch 'release/2.8.0'
This commit is contained in:
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
.php_cs.cache
|
||||||
composer.lock
|
composer.lock
|
||||||
vendor
|
|
||||||
mustache.php
|
mustache.php
|
||||||
|
vendor
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$config = new Symfony\CS\Config\Config();
|
use Symfony\CS\Config\Config;
|
||||||
$config->getFinder()->in(__DIR__)->exclude('bin');
|
use Symfony\CS\FixerInterface;
|
||||||
|
|
||||||
|
$config = Config::create()
|
||||||
|
// use symfony level and extra fixers:
|
||||||
|
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
|
||||||
|
->fixers(array('align_double_arrow', '-concat_without_spaces', 'concat_with_spaces', 'ordered_use', 'strict'))
|
||||||
|
->setUsingLinter(false);
|
||||||
|
|
||||||
|
$finder = $config->getFinder()
|
||||||
|
->in(__DIR__);
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
preset: symfony
|
||||||
|
|
||||||
|
enabled:
|
||||||
|
- align_double_arrow
|
||||||
|
- concat_with_spaces
|
||||||
|
- ordered_use
|
||||||
|
- strict
|
||||||
|
|
||||||
|
disabled:
|
||||||
|
- concat_without_spaces
|
||||||
+11
-3
@@ -1,11 +1,11 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
before_script:
|
install:
|
||||||
- curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o php-cs-fixer.phar
|
- curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- phpunit
|
- phpunit
|
||||||
- if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=');"` ]]; then php php-cs-fixer.phar --dry-run -v fix .; fi
|
- if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=') && !defined('HHVM_VERSION');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.2
|
- 5.2
|
||||||
@@ -14,3 +14,11 @@ php:
|
|||||||
- 5.5
|
- 5.5
|
||||||
- 5.6
|
- 5.6
|
||||||
- hhvm
|
- hhvm
|
||||||
|
- hhvm-nightly
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
- php: hhvm-nightly
|
||||||
|
fast_finish: true
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ Mustache.php
|
|||||||
|
|
||||||
A [Mustache](http://mustache.github.com/) implementation in PHP.
|
A [Mustache](http://mustache.github.com/) implementation in PHP.
|
||||||
|
|
||||||
[](https://packagist.org/packages/mustache/mustache)
|
[](https://packagist.org/packages/mustache/mustache)
|
||||||
[](http://travis-ci.org/bobthecow/mustache.php)
|
[](http://travis-ci.org/bobthecow/mustache.php)
|
||||||
[](https://packagist.org/packages/mustache/mustache)
|
[](https://packagist.org/packages/mustache/mustache)
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@@ -24,9 +24,9 @@ And a more in-depth example -- this is the canonical Mustache template:
|
|||||||
|
|
||||||
```html+jinja
|
```html+jinja
|
||||||
Hello {{name}}
|
Hello {{name}}
|
||||||
You have just won ${{value}}!
|
You have just won {{value}} dollars!
|
||||||
{{#in_ca}}
|
{{#in_ca}}
|
||||||
Well, ${{taxed_value}}, after taxes.
|
Well, {{taxed_value}} dollars, after taxes.
|
||||||
{{/in_ca}}
|
{{/in_ca}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A shell script to create a single-file class cache of the entire Mustache
|
* A shell script to create a single-file class cache of the entire Mustache
|
||||||
* library:
|
* library.
|
||||||
*
|
*
|
||||||
* $ bin/build_bootstrap.php
|
* $ bin/build_bootstrap.php
|
||||||
*
|
*
|
||||||
@@ -72,7 +72,6 @@ SymfonyClassCollectionLoader::load(array(
|
|||||||
* the unnecessary bits removed.
|
* the unnecessary bits removed.
|
||||||
*
|
*
|
||||||
* @license http://www.opensource.org/licenses/MIT
|
* @license http://www.opensource.org/licenses/MIT
|
||||||
*
|
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
*/
|
*/
|
||||||
class SymfonyClassCollectionLoader
|
class SymfonyClassCollectionLoader
|
||||||
|
|||||||
+27
-22
@@ -2,7 +2,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A commandline script to create an example and the needed files:
|
* A commandline script to create an example and the needed files.
|
||||||
*
|
*
|
||||||
* $ bin/create_example.php my_new_example
|
* $ bin/create_example.php my_new_example
|
||||||
*
|
*
|
||||||
@@ -26,6 +26,7 @@ define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* transform a string to lowercase using underlines.
|
* transform a string to lowercase using underlines.
|
||||||
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* String -> string
|
* String -> string
|
||||||
* AString -> a_string
|
* AString -> a_string
|
||||||
@@ -34,18 +35,20 @@ define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @access public
|
* @access public
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* transform a string to Uppercase (camelcase)
|
* transform a string to Uppercase (camelcase).
|
||||||
|
*
|
||||||
* Examples
|
* Examples
|
||||||
* string -> String
|
* string -> String
|
||||||
* a_string -> AString
|
* a_string -> AString
|
||||||
@@ -54,21 +57,23 @@ function getLowerCaseName($name)
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @access public
|
* @access public
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the given value and echo it out appending "\n"
|
* return the given value and echo it out appending "\n".
|
||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @access public
|
* @access public
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function out($value)
|
function out($value)
|
||||||
@@ -79,30 +84,32 @@ function out($value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create Path for certain files in an example
|
* create Path for certain files in an example.
|
||||||
|
*
|
||||||
* returns the directory name if only $directory is given.
|
* returns the directory name if only $directory is given.
|
||||||
* if an extension is given a complete filename is returned.
|
* if an extension is given a complete filename is returned.
|
||||||
* the returned filename will be echoed out
|
* the returned filename will be echoed out.
|
||||||
*
|
*
|
||||||
* @param string $directory directory without / at the end
|
* @param string $directory directory without / at the end
|
||||||
* @param string $filename filename without path and extension
|
* @param string $filename filename without path and extension
|
||||||
* @param string $extension extension of the file without "."
|
* @param string $extension extension of the file without "."
|
||||||
* @access public
|
* @access public
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
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 : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates the directory for the example
|
* creates the directory for the example.
|
||||||
* the script die()'s if mkdir() fails
|
*
|
||||||
|
* the script die()'s if mkdir() fails.
|
||||||
*
|
*
|
||||||
* @param string $directory
|
* @param string $directory
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function createDirectory($directory)
|
function createDirectory($directory)
|
||||||
{
|
{
|
||||||
@@ -112,19 +119,19 @@ function createDirectory($directory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a file for the example with the given $content
|
* create a file for the example with the given $content.
|
||||||
* the script die()'s if fopen() fails
|
*
|
||||||
|
* the script die()'s if fopen() fails.
|
||||||
*
|
*
|
||||||
* @param string $directory directory without / at the end
|
* @param string $directory directory without / at the end
|
||||||
* @param string $filename filename without path and extension
|
* @param string $filename filename without path and extension
|
||||||
* @param string $extension extension of the file without "."
|
* @param string $extension extension of the file without "."
|
||||||
* @param string $content the content of the file
|
* @param string $content the content of the file
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
@@ -134,7 +141,7 @@ function createFile($directory, $filename, $extension, $content = "")
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* routine to create the example directory and 3 files
|
* routine to create the example directory and 3 files.
|
||||||
*
|
*
|
||||||
* if the $example_name is "SomeThing" the following files will be created
|
* if the $example_name is "SomeThing" the following files will be created
|
||||||
* examples/some_thing
|
* examples/some_thing
|
||||||
@@ -144,16 +151,15 @@ function createFile($directory, $filename, $extension, $content = "")
|
|||||||
*
|
*
|
||||||
* @param mixed $example_name
|
* @param mixed $example_name
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function main($example_name)
|
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} {
|
||||||
@@ -170,7 +176,6 @@ if (count($argv) > 1) {
|
|||||||
$example_name = $argv[1];
|
$example_name = $argv[1];
|
||||||
|
|
||||||
main($example_name);
|
main($example_name);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo USAGE;
|
echo USAGE;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,8 @@
|
|||||||
"php": ">=5.2.4"
|
"php": ">=5.2.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "*"
|
"phpunit/phpunit": "~3.7|~4.0",
|
||||||
|
"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);
|
||||||
|
|
||||||
@@ -31,8 +31,6 @@ interface Mustache_Cache
|
|||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function cache($key, $value);
|
public function cache($key, $value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -56,12 +56,10 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache and load the compiled class
|
* Cache and load the compiled class.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function cache($key, $value)
|
public function cache($key, $value)
|
||||||
{
|
{
|
||||||
@@ -91,7 +89,7 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create cache directory
|
* Create cache directory.
|
||||||
*
|
*
|
||||||
* @throws Mustache_Exception_RuntimeException If unable to create directory
|
* @throws Mustache_Exception_RuntimeException If unable to create directory
|
||||||
*
|
*
|
||||||
@@ -119,14 +117,12 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write cache file
|
* Write cache file.
|
||||||
*
|
*
|
||||||
* @throws Mustache_Exception_RuntimeException If unable to write file
|
* @throws Mustache_Exception_RuntimeException If unable to write file
|
||||||
*
|
*
|
||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
private function writeFile($fileName, $value)
|
private function writeFile($fileName, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -34,8 +34,6 @@ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
|
|||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $value
|
* @param string $value
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function cache($key, $value)
|
public function cache($key, $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Compiler
|
class Mustache_Compiler
|
||||||
{
|
{
|
||||||
|
|
||||||
private $pragmas;
|
private $pragmas;
|
||||||
private $defaultPragmas = array();
|
private $defaultPragmas = array();
|
||||||
private $sections;
|
private $sections;
|
||||||
@@ -264,7 +263,7 @@ class Mustache_Compiler
|
|||||||
|
|
||||||
const BLOCK_ARG = '
|
const BLOCK_ARG = '
|
||||||
// %s block_arg
|
// %s block_arg
|
||||||
$value = $this->section%s($context, $indent, true);
|
$value = $this->section%s($context, \'\', true);
|
||||||
$newContext[%s] = %s$value;
|
$newContext[%s] = %s$value;
|
||||||
';
|
';
|
||||||
|
|
||||||
@@ -458,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)
|
||||||
{
|
{
|
||||||
@@ -475,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
|
||||||
@@ -546,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
|
||||||
*/
|
*/
|
||||||
@@ -561,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)';
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Engine
|
class Mustache_Engine
|
||||||
{
|
{
|
||||||
const VERSION = '2.7.0';
|
const VERSION = '2.8.0';
|
||||||
const SPEC_VERSION = '1.1.2';
|
const SPEC_VERSION = '1.1.2';
|
||||||
|
|
||||||
const PRAGMA_FILTERS = 'FILTERS';
|
const PRAGMA_FILTERS = 'FILTERS';
|
||||||
@@ -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()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Mustache_Loader_CascadingLoader implements Mustache_Loader
|
|||||||
private $loaders;
|
private $loaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a CascadingLoader with an array of loaders:
|
* Construct a CascadingLoader with an array of loaders.
|
||||||
*
|
*
|
||||||
* $loader = new Mustache_Loader_CascadingLoader(array(
|
* $loader = new Mustache_Loader_CascadingLoader(array(
|
||||||
* new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
|
* new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
|
||||||
|
|||||||
@@ -46,7 +46,6 @@
|
|||||||
*
|
*
|
||||||
* @@ hello
|
* @@ hello
|
||||||
* Hello, {{ name }}!
|
* Hello, {{ name }}!
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Mustache_Loader_InlineLoader implements Mustache_Loader
|
class Mustache_Loader_InlineLoader implements Mustache_Loader
|
||||||
{
|
{
|
||||||
@@ -56,6 +55,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The InlineLoader requires a filename and offset to process templates.
|
* The InlineLoader requires a filename and offset to process templates.
|
||||||
|
*
|
||||||
* The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually
|
* The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually
|
||||||
* perfectly suited to the job:
|
* perfectly suited to the job:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ interface Mustache_Loader_MutableLoader
|
|||||||
* Set an associative array of Template sources for this loader.
|
* Set an associative array of Template sources for this loader.
|
||||||
*
|
*
|
||||||
* @param array $templates
|
* @param array $templates
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setTemplates(array $templates);
|
public function setTemplates(array $templates);
|
||||||
|
|
||||||
@@ -28,8 +26,6 @@ interface Mustache_Loader_MutableLoader
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $template Mustache Template source
|
* @param string $template Mustache Template source
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setTemplate($name, $template);
|
public function setTemplate($name, $template);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-20
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a Mustache logger instance
|
* Describes a Mustache logger instance.
|
||||||
*
|
*
|
||||||
* This is identical to the Psr\Log\LoggerInterface.
|
* This is identical to the Psr\Log\LoggerInterface.
|
||||||
*
|
*
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
interface Mustache_Logger
|
interface Mustache_Logger
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Psr\Log compatible log levels
|
* Psr\Log compatible log levels.
|
||||||
*/
|
*/
|
||||||
const EMERGENCY = 'emergency';
|
const EMERGENCY = 'emergency';
|
||||||
const ALERT = 'alert';
|
const ALERT = 'alert';
|
||||||
@@ -45,8 +45,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function emergency($message, array $context = array());
|
public function emergency($message, array $context = array());
|
||||||
|
|
||||||
@@ -58,8 +56,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function alert($message, array $context = array());
|
public function alert($message, array $context = array());
|
||||||
|
|
||||||
@@ -70,8 +66,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function critical($message, array $context = array());
|
public function critical($message, array $context = array());
|
||||||
|
|
||||||
@@ -81,8 +75,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function error($message, array $context = array());
|
public function error($message, array $context = array());
|
||||||
|
|
||||||
@@ -94,8 +86,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function warning($message, array $context = array());
|
public function warning($message, array $context = array());
|
||||||
|
|
||||||
@@ -104,8 +94,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function notice($message, array $context = array());
|
public function notice($message, array $context = array());
|
||||||
|
|
||||||
@@ -116,8 +104,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function info($message, array $context = array());
|
public function info($message, array $context = array());
|
||||||
|
|
||||||
@@ -126,8 +112,6 @@ interface Mustache_Logger
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function debug($message, array $context = array());
|
public function debug($message, array $context = array());
|
||||||
|
|
||||||
@@ -137,8 +121,6 @@ interface Mustache_Logger
|
|||||||
* @param mixed $level
|
* @param mixed $level
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
*/
|
||||||
public function log($level, $message, array $context = array());
|
public function log($level, $message, array $context = array());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ abstract class Mustache_Template
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mustache Template instances can be treated as a function and rendered by simply calling them:
|
* Mustache Template instances can be treated as a function and rendered by simply calling them.
|
||||||
*
|
*
|
||||||
* $m = new Mustache_Engine;
|
* $m = new Mustache_Engine;
|
||||||
* $tpl = $m->loadTemplate('Hello, {{ name }}!');
|
* $tpl = $m->loadTemplate('Hello, {{ name }}!');
|
||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,13 +53,6 @@ class Mustache_Tokenizer
|
|||||||
self::T_BLOCK_VAR => true,
|
self::T_BLOCK_VAR => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Interpolated tags
|
|
||||||
private static $interpolatedTags = array(
|
|
||||||
self::T_ESCAPED => true,
|
|
||||||
self::T_UNESCAPED => true,
|
|
||||||
self::T_UNESCAPED_2 => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Token properties
|
// Token properties
|
||||||
const TYPE = 'type';
|
const TYPE = 'type';
|
||||||
const NAME = 'name';
|
const NAME = 'name';
|
||||||
@@ -75,7 +68,6 @@ class Mustache_Tokenizer
|
|||||||
|
|
||||||
private $state;
|
private $state;
|
||||||
private $tagType;
|
private $tagType;
|
||||||
private $tag;
|
|
||||||
private $buffer;
|
private $buffer;
|
||||||
private $tokens;
|
private $tokens;
|
||||||
private $seenTag;
|
private $seenTag;
|
||||||
@@ -163,7 +155,7 @@ class Mustache_Tokenizer
|
|||||||
self::OTAG => $this->otag,
|
self::OTAG => $this->otag,
|
||||||
self::CTAG => $this->ctag,
|
self::CTAG => $this->ctag,
|
||||||
self::LINE => $this->line,
|
self::LINE => $this->line,
|
||||||
self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen
|
self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->tagType === self::T_UNESCAPED) {
|
if ($this->tagType === self::T_UNESCAPED) {
|
||||||
@@ -224,7 +216,6 @@ class Mustache_Tokenizer
|
|||||||
{
|
{
|
||||||
$this->state = self::IN_TEXT;
|
$this->state = self::IN_TEXT;
|
||||||
$this->tagType = null;
|
$this->tagType = null;
|
||||||
$this->tag = null;
|
|
||||||
$this->buffer = '';
|
$this->buffer = '';
|
||||||
$this->tokens = array();
|
$this->tokens = array();
|
||||||
$this->seenTag = false;
|
$this->seenTag = false;
|
||||||
@@ -244,7 +235,7 @@ class Mustache_Tokenizer
|
|||||||
$this->tokens[] = array(
|
$this->tokens[] = array(
|
||||||
self::TYPE => self::T_TEXT,
|
self::TYPE => self::T_TEXT,
|
||||||
self::LINE => $this->line,
|
self::LINE => $this->line,
|
||||||
self::VALUE => $this->buffer
|
self::VALUE => $this->buffer,
|
||||||
);
|
);
|
||||||
$this->buffer = '';
|
$this->buffer = '';
|
||||||
}
|
}
|
||||||
@@ -322,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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getCompileValues
|
* @dataProvider getCompileValues
|
||||||
*/
|
*/
|
||||||
@@ -48,7 +47,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::NAME => 'name',
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'Monkey',
|
'Monkey',
|
||||||
true,
|
true,
|
||||||
@@ -59,7 +58,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
||||||
'$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
|
'$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -68,7 +67,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::NAME => 'name',
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'Monkey',
|
'Monkey',
|
||||||
false,
|
false,
|
||||||
@@ -79,7 +78,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
||||||
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_COMPAT . ', \'ISO-8859-1\');',
|
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_COMPAT . ', \'ISO-8859-1\');',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -88,7 +87,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::NAME => 'name',
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'Monkey',
|
'Monkey',
|
||||||
false,
|
false,
|
||||||
@@ -99,7 +98,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
||||||
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_QUOTES . ', \'ISO-8859-1\');',
|
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_QUOTES . ', \'ISO-8859-1\');',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -128,7 +127,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'$value = $this->resolveValue($context->last(), $context, $indent);',
|
'$value = $this->resolveValue($context->last(), $context, $indent);',
|
||||||
'$buffer .= \'\\\'bar\\\'\';',
|
'$buffer .= \'\\\'bar\\\'\';',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$two = new Mustache_Context(array(
|
$two = new Mustache_Context(array(
|
||||||
'foo' => 'FOO',
|
'foo' => 'FOO',
|
||||||
'bar' => '<BAR>'
|
'bar' => '<BAR>',
|
||||||
));
|
));
|
||||||
$this->assertEquals('FOO', $two->find('foo'));
|
$this->assertEquals('FOO', $two->find('foo'));
|
||||||
$this->assertEquals('<BAR>', $two->find('bar'));
|
$this->assertEquals('<BAR>', $two->find('bar'));
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
|||||||
public function testWithoutLambdaCache()
|
public function testWithoutLambdaCache()
|
||||||
{
|
{
|
||||||
$mustache = new MustacheStub(array(
|
$mustache = new MustacheStub(array(
|
||||||
'cache' => self::$tempDir
|
'cache' => self::$tempDir,
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertInstanceOf('Mustache_Cache_NoopCache', $mustache->getProtectedLambdaCache());
|
$this->assertInstanceOf('Mustache_Cache_NoopCache', $mustache->getProtectedLambdaCache());
|
||||||
@@ -193,7 +193,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
|||||||
'partials_loader' => new Mustache_Loader_ArrayLoader(array(
|
'partials_loader' => new Mustache_Loader_ArrayLoader(array(
|
||||||
'foo' => 'FOO',
|
'foo' => 'FOO',
|
||||||
'baz' => 'BAZ',
|
'baz' => 'BAZ',
|
||||||
))
|
)),
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertEquals('FOOBAZ', $mustache->render('{{>foo}}{{>bar}}{{>baz}}', array()));
|
$this->assertEquals('FOOBAZ', $mustache->render('{{>foo}}{{>bar}}{{>baz}}', array()));
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
|||||||
public function testUnknownPragmaThrowsException()
|
public function testUnknownPragmaThrowsException()
|
||||||
{
|
{
|
||||||
new Mustache_Engine(array(
|
new Mustache_Engine(array(
|
||||||
'pragmas' => array('UNKNOWN')
|
'pragmas' => array('UNKNOWN'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
|||||||
{
|
{
|
||||||
$name = tempnam(sys_get_temp_dir(), 'mustache-test');
|
$name = tempnam(sys_get_temp_dir(), 'mustache-test');
|
||||||
$mustache = new Mustache_Engine(array(
|
$mustache = new Mustache_Engine(array(
|
||||||
'logger' => new Mustache_Logger_StreamLogger($name, $level)
|
'logger' => new Mustache_Logger_StreamLogger($name, $level),
|
||||||
));
|
));
|
||||||
|
|
||||||
return array($name, $mustache);
|
return array($name, $mustache);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Mustache_Test_FiveThree_Functional_EngineTest extends PHPUnit_Framework_Te
|
|||||||
$helpers = array(
|
$helpers = array(
|
||||||
'longdate' => function (\DateTime $value) {
|
'longdate' => function (\DateTime $value) {
|
||||||
return $value->format('Y-m-d h:m:s');
|
return $value->format('Y-m-d h:m:s');
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
|
|||||||
@@ -46,15 +46,15 @@ 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',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'{{% FILTERS }}{{# word | echo }}{{ . }}!{{/ word | echo }}',
|
'{{% FILTERS }}{{# word | echo }}{{ . }}!{{/ word | echo }}',
|
||||||
$helpers,
|
$helpers,
|
||||||
array('word' => 'bacon'),
|
array('word' => 'bacon'),
|
||||||
'bacon!bacon!bacon!'
|
'bacon!bacon!bacon!',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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,7 +55,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
|
|||||||
'name' => 'Bob',
|
'name' => 'Bob',
|
||||||
'wrap' => function ($text) {
|
'wrap' => function ($text) {
|
||||||
return sprintf('[[%s]]', $text);
|
return sprintf('[[%s]]', $text);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(sprintf('[[%s]]', $data['name']), $tpl->render($data));
|
$this->assertEquals(sprintf('[[%s]]', $data['name']), $tpl->render($data));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PHPUnit test case wrapping the Mustache Spec
|
* A PHPUnit test case wrapping the Mustache Spec.
|
||||||
*
|
*
|
||||||
* @group mustache-spec
|
* @group mustache-spec
|
||||||
* @group functional
|
* @group functional
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_FiveThree_Functional_PartialLambdaIndentTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_FiveThree_Functional_PartialLambdaIndentTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testLambdasInsidePartialsAreIndentedProperly()
|
public function testLambdasInsidePartialsAreIndentedProperly()
|
||||||
{
|
{
|
||||||
$src = <<<EOS
|
$src = <<<EOS
|
||||||
@@ -37,7 +36,7 @@ EOS;
|
|||||||
EOS;
|
EOS;
|
||||||
|
|
||||||
$m = new Mustache_Engine(array(
|
$m = new Mustache_Engine(array(
|
||||||
'partials' => array('input' => $partial)
|
'partials' => array('input' => $partial),
|
||||||
));
|
));
|
||||||
|
|
||||||
$tpl = $m->loadTemplate($src);
|
$tpl = $m->loadTemplate($src);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testCallEatsContext()
|
public function testCallEatsContext()
|
||||||
{
|
{
|
||||||
$m = new Mustache_Engine();
|
$m = new Mustache_Engine();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test everything in the `examples` directory.
|
* Test everything in the `examples` directory.
|
||||||
*
|
*
|
||||||
@@ -29,7 +28,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testExamples($context, $source, $partials, $expected)
|
public function testExamples($context, $source, $partials, $expected)
|
||||||
{
|
{
|
||||||
$mustache = new Mustache_Engine(array(
|
$mustache = new Mustache_Engine(array(
|
||||||
'partials' => $partials
|
'partials' => $partials,
|
||||||
));
|
));
|
||||||
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
|
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
|
||||||
}
|
}
|
||||||
@@ -52,7 +51,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$handle = opendir($path);
|
$handle = opendir($path);
|
||||||
while (($file = readdir($handle)) !== false) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
if ($file == '.' || $file == '..') {
|
if ($file === '.' || $file === '..') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +84,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
|||||||
$fullpath = $path . '/' . $file;
|
$fullpath = $path . '/' . $file;
|
||||||
$info = pathinfo($fullpath);
|
$info = pathinfo($fullpath);
|
||||||
|
|
||||||
if (is_dir($fullpath) && $info['basename'] == 'partials') {
|
if (is_dir($fullpath) && $info['basename'] === 'partials') {
|
||||||
// load partials
|
// load partials
|
||||||
$partials = $this->loadPartials($fullpath);
|
$partials = $this->loadPartials($fullpath);
|
||||||
} elseif (is_file($fullpath)) {
|
} elseif (is_file($fullpath)) {
|
||||||
@@ -125,7 +124,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$handle = opendir($path);
|
$handle = opendir($path);
|
||||||
while (($file = readdir($handle)) !== false) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
if ($file == '.' || $file == '..') {
|
if ($file === '.' || $file === '..') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
* @group inheritance
|
* @group inheritance
|
||||||
* @group functional
|
* @group functional
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $mustache;
|
private $mustache;
|
||||||
@@ -24,13 +23,13 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
'foo' => '{{$baz}}default content{{/baz}}',
|
'foo' => '{{$baz}}default content{{/baz}}',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'bar' => 'set by user'
|
'bar' => 'set by user',
|
||||||
),
|
),
|
||||||
'{{< foo }}{{# bar }}{{$ baz }}{{/ baz }}{{/ bar }}{{/ foo }}',
|
'{{< foo }}{{# bar }}{{$ baz }}{{/ baz }}{{/ bar }}{{/ foo }}',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'foo' => '{{$baz}}default content{{/baz}}'
|
'foo' => '{{$baz}}default content{{/baz}}',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
),
|
),
|
||||||
@@ -39,19 +38,19 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'foo' => '{{$baz}}default content{{/baz}}',
|
'foo' => '{{$baz}}default content{{/baz}}',
|
||||||
'qux' => 'I am a partial'
|
'qux' => 'I am a partial',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
),
|
),
|
||||||
'{{<foo}}{{>qux}}{{$baz}}set by template{{/baz}}{{/foo}}'
|
'{{<foo}}{{>qux}}{{$baz}}set by template{{/baz}}{{/foo}}',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'foo' => '{{$baz}}default content{{/baz}}'
|
'foo' => '{{$baz}}default content{{/baz}}',
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
'{{<foo}}{{=<% %>=}}<%={{ }}=%>{{/foo}}'
|
'{{<foo}}{{=<% %>=}}<%={{ }}=%>{{/foo}}',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,28 +62,28 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
'foo' => '{{$baz}}default content{{/baz}}',
|
'foo' => '{{$baz}}default content{{/baz}}',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'bar' => 'set by user'
|
'bar' => 'set by user',
|
||||||
),
|
),
|
||||||
'{{<foo}}{{bar}}{{$baz}}override{{/baz}}{{/foo}}',
|
'{{<foo}}{{bar}}{{$baz}}override{{/baz}}{{/foo}}',
|
||||||
'override'
|
'override',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'foo' => '{{$baz}}default content{{/baz}}'
|
'foo' => '{{$baz}}default content{{/baz}}',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
),
|
),
|
||||||
'{{<foo}}{{! ignore me }}{{$baz}}set by template{{/baz}}{{/foo}}',
|
'{{<foo}}{{! ignore me }}{{$baz}}set by template{{/baz}}{{/foo}}',
|
||||||
'set by template'
|
'set by template',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'foo' => '{{$baz}}defualt content{{/baz}}'
|
'foo' => '{{$baz}}defualt content{{/baz}}',
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
'{{<foo}}set by template{{$baz}}also set by template{{/baz}}{{/foo}}',
|
'{{<foo}}set by template{{$baz}}also set by template{{/baz}}{{/foo}}',
|
||||||
'also set by template'
|
'also set by template',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +101,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
$tpl = $this->mustache->loadTemplate('{{$foo}}default {{bar}} content{{/foo}}');
|
$tpl = $this->mustache->loadTemplate('{{$foo}}default {{bar}} content{{/foo}}');
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'bar' => 'baz'
|
'bar' => 'baz',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('default baz content', $tpl->render($data));
|
$this->assertEquals('default baz content', $tpl->render($data));
|
||||||
@@ -113,7 +112,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
$tpl = $this->mustache->loadTemplate('{{$foo}}default {{{bar}}} content{{/foo}}');
|
$tpl = $this->mustache->loadTemplate('{{$foo}}default {{{bar}}} content{{/foo}}');
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'bar' => '<baz>'
|
'bar' => '<baz>',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('default <baz> content', $tpl->render($data));
|
$this->assertEquals('default <baz> content', $tpl->render($data));
|
||||||
@@ -126,7 +125,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
);
|
);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'bar' => array('baz' => 'qux')
|
'bar' => array('baz' => 'qux'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('default qux content', $tpl->render($data));
|
$this->assertEquals('default qux content', $tpl->render($data));
|
||||||
@@ -140,11 +139,10 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'foo' => array('bar' => 'qux'),
|
'foo' => array('bar' => 'qux'),
|
||||||
'baz' => 'three'
|
'baz' => 'three',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('default three content', $tpl->render($data));
|
$this->assertEquals('default three content', $tpl->render($data));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMustacheInjectionInDefaultContent()
|
public function testMustacheInjectionInDefaultContent()
|
||||||
@@ -154,7 +152,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
);
|
);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'bar' => array('baz' => '{{qux}}')
|
'bar' => array('baz' => '{{qux}}'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('default {{qux}} content', $tpl->render($data));
|
$this->assertEquals('default {{qux}} content', $tpl->render($data));
|
||||||
@@ -163,7 +161,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testDefaultContentRenderedInsideIncludedTemplates()
|
public function testDefaultContentRenderedInsideIncludedTemplates()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$foo}}default content{{/foo}}'
|
'include' => '{{$foo}}default content{{/foo}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -180,7 +178,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testOverriddenContent()
|
public function testOverriddenContent()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'super' => '...{{$title}}Default title{{/title}}...'
|
'super' => '...{{$title}}Default title{{/title}}...',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -197,7 +195,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testOverriddenPartial()
|
public function testOverriddenPartial()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'partial' => '|{{$stuff}}...{{/stuff}}{{$default}} default{{/default}}|'
|
'partial' => '|{{$stuff}}...{{/stuff}}{{$default}} default{{/default}}|',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -214,7 +212,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testDataDoesNotOverrideBlock()
|
public function testDataDoesNotOverrideBlock()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$var}}var in include{{/var}}'
|
'include' => '{{$var}}var in include{{/var}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -224,7 +222,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
);
|
);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'var' => 'var in data'
|
'var' => 'var in data',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('var in template', $tpl->render($data));
|
$this->assertEquals('var in template', $tpl->render($data));
|
||||||
@@ -233,7 +231,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testDataDoesNotOverrideDefaultBlockValue()
|
public function testDataDoesNotOverrideDefaultBlockValue()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$var}}var in include{{/var}}'
|
'include' => '{{$var}}var in include{{/var}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -243,7 +241,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
);
|
);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'var' => 'var in data'
|
'var' => 'var in data',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals('var in include', $tpl->render($data));
|
$this->assertEquals('var in include', $tpl->render($data));
|
||||||
@@ -252,7 +250,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testOverridePartialWithNewlines()
|
public function testOverridePartialWithNewlines()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'partial' => '{{$ballmer}}peaking{{/ballmer}}'
|
'partial' => '{{$ballmer}}peaking{{/ballmer}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -269,9 +267,8 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testInheritIndentationWhenOverridingAPartial()
|
public function testInheritIndentationWhenOverridingAPartial()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'partial' =>
|
'partial' => 'stop:
|
||||||
'stop:
|
{{$nineties}}collaborate and listen{{/nineties}}',
|
||||||
{{$nineties}}collaborate and listen{{/nineties}}'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -289,10 +286,33 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testInheritSpacingWhenOverridingAPartial()
|
||||||
|
{
|
||||||
|
$partials = array(
|
||||||
|
'parent' => 'collaborate_and{{$id}}{{/id}}',
|
||||||
|
'child' => '{{<parent}}{{$id}}_listen{{/id}}{{/parent}}',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->mustache->setPartials($partials);
|
||||||
|
|
||||||
|
$tpl = $this->mustache->loadTemplate(
|
||||||
|
'stop:
|
||||||
|
{{>child}}'
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'stop:
|
||||||
|
collaborate_and_listen',
|
||||||
|
$tpl->render($data)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testOverrideOneSubstitutionButNotTheOther()
|
public function testOverrideOneSubstitutionButNotTheOther()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'partial' => '{{$stuff}}default one{{/stuff}}, {{$stuff2}}default two{{/stuff2}}'
|
'partial' => '{{$stuff}}default one{{/stuff}}, {{$stuff2}}default two{{/stuff2}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -309,7 +329,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testSuperTemplatesWithNoParameters()
|
public function testSuperTemplatesWithNoParameters()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$foo}}default content{{/foo}}'
|
'include' => '{{$foo}}default content{{/foo}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -327,7 +347,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$foo}}default content{{/foo}} {{$bar}}{{<include2}}{{/include2}}{{/bar}}',
|
'include' => '{{$foo}}default content{{/foo}} {{$bar}}{{<include2}}{{/include2}}{{/bar}}',
|
||||||
'include2' => '{{$foo}}include2 default content{{/foo}} {{<include}}{{$bar}}don\'t recurse{{/bar}}{{/include}}'
|
'include2' => '{{$foo}}include2 default content{{/foo}} {{<include}}{{$bar}}don\'t recurse{{/bar}}{{/include}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -346,7 +366,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
$partials = array(
|
$partials = array(
|
||||||
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
||||||
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
||||||
'grandParent' => '{{$a}}g{{/a}}'
|
'grandParent' => '{{$a}}g{{/a}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -365,7 +385,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
$partials = array(
|
$partials = array(
|
||||||
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
||||||
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
||||||
'grandParent' => '{{$a}}g{{/a}}'
|
'grandParent' => '{{$a}}g{{/a}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -382,7 +402,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testIgnoreTextInsideSuperTemplatesButParseArgs()
|
public function testIgnoreTextInsideSuperTemplatesButParseArgs()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$foo}}default content{{/foo}}'
|
'include' => '{{$foo}}default content{{/foo}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
@@ -399,7 +419,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
|||||||
public function testIgnoreTextInsideSuperTemplates()
|
public function testIgnoreTextInsideSuperTemplates()
|
||||||
{
|
{
|
||||||
$partials = array(
|
$partials = array(
|
||||||
'include' => '{{$foo}}default content{{/foo}}'
|
'include' => '{{$foo}}default content{{/foo}}',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->mustache->setPartials($partials);
|
$this->mustache->setPartials($partials);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $mustache;
|
private $mustache;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
@@ -36,25 +35,25 @@ class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_T
|
|||||||
{
|
{
|
||||||
$interpolationData = array(
|
$interpolationData = array(
|
||||||
'a' => '{{ b }}',
|
'a' => '{{ b }}',
|
||||||
'b' => 'FAIL'
|
'b' => 'FAIL',
|
||||||
);
|
);
|
||||||
|
|
||||||
$sectionData = array(
|
$sectionData = array(
|
||||||
'a' => true,
|
'a' => true,
|
||||||
'b' => '{{ c }}',
|
'b' => '{{ c }}',
|
||||||
'c' => 'FAIL'
|
'c' => 'FAIL',
|
||||||
);
|
);
|
||||||
|
|
||||||
$lambdaInterpolationData = array(
|
$lambdaInterpolationData = array(
|
||||||
'a' => array($this, 'lambdaInterpolationCallback'),
|
'a' => array($this, 'lambdaInterpolationCallback'),
|
||||||
'b' => '{{ c }}',
|
'b' => '{{ c }}',
|
||||||
'c' => 'FAIL'
|
'c' => 'FAIL',
|
||||||
);
|
);
|
||||||
|
|
||||||
$lambdaSectionData = array(
|
$lambdaSectionData = array(
|
||||||
'a' => array($this, 'lambdaSectionCallback'),
|
'a' => array($this, 'lambdaSectionCallback'),
|
||||||
'b' => '{{ c }}',
|
'b' => '{{ c }}',
|
||||||
'c' => 'FAIL'
|
'c' => 'FAIL',
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PHPUnit test case wrapping the Mustache Spec
|
* A PHPUnit test case wrapping the Mustache Spec.
|
||||||
*
|
*
|
||||||
* @group mustache-spec
|
* @group mustache-spec
|
||||||
* @group functional
|
* @group functional
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Mustache_Test_Functional_NestedPartialIndentTest extends PHPUnit_Framework
|
|||||||
public function testNestedPartialsAreIndentedProperly($src, array $partials, $expected)
|
public function testNestedPartialsAreIndentedProperly($src, array $partials, $expected)
|
||||||
{
|
{
|
||||||
$m = new Mustache_Engine(array(
|
$m = new Mustache_Engine(array(
|
||||||
'partials' => $partials
|
'partials' => $partials,
|
||||||
));
|
));
|
||||||
$tpl = $m->loadTemplate($src);
|
$tpl = $m->loadTemplate($src);
|
||||||
$this->assertEquals($expected, $tpl->render());
|
$this->assertEquals($expected, $tpl->render());
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ abstract class Mustache_Test_FunctionalTestCase extends PHPUnit_Framework_TestCa
|
|||||||
$path = rtrim($path, '/') . '/';
|
$path = rtrim($path, '/') . '/';
|
||||||
$handle = opendir($path);
|
$handle = opendir($path);
|
||||||
while (($file = readdir($handle)) !== false) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
if ($file == '.' || $file == '..') {
|
if ($file === '.' || $file === '..') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testConstructor()
|
public function testConstructor()
|
||||||
{
|
{
|
||||||
$loader = new Mustache_Loader_ArrayLoader(array(
|
$loader = new Mustache_Loader_ArrayLoader(array(
|
||||||
'foo' => 'bar'
|
'foo' => 'bar',
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertEquals('bar', $loader->load('foo'));
|
$this->assertEquals('bar', $loader->load('foo'));
|
||||||
@@ -26,7 +26,7 @@ class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testSetAndLoadTemplates()
|
public function testSetAndLoadTemplates()
|
||||||
{
|
{
|
||||||
$loader = new Mustache_Loader_ArrayLoader(array(
|
$loader = new Mustache_Loader_ArrayLoader(array(
|
||||||
'foo' => 'bar'
|
'foo' => 'bar',
|
||||||
));
|
));
|
||||||
$this->assertEquals('bar', $loader->load('foo'));
|
$this->assertEquals('bar', $loader->load('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);
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Logger::ERROR,
|
Mustache_Logger::ERROR,
|
||||||
'error message',
|
'error message',
|
||||||
array('name' => 'foo', 'number' => 42),
|
array('name' => 'foo', 'number' => 42),
|
||||||
"ERROR: error message\n"
|
"ERROR: error message\n",
|
||||||
),
|
),
|
||||||
|
|
||||||
// with interpolation
|
// with interpolation
|
||||||
@@ -142,7 +142,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Logger::ERROR,
|
Mustache_Logger::ERROR,
|
||||||
'error {name}-{number}',
|
'error {name}-{number}',
|
||||||
array('name' => 'foo', 'number' => 42),
|
array('name' => 'foo', 'number' => 42),
|
||||||
"ERROR: error foo-42\n"
|
"ERROR: error foo-42\n",
|
||||||
),
|
),
|
||||||
|
|
||||||
// with iterpolation false positive
|
// with iterpolation false positive
|
||||||
@@ -150,7 +150,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Logger::ERROR,
|
Mustache_Logger::ERROR,
|
||||||
'error {nothing}',
|
'error {nothing}',
|
||||||
array('name' => 'foo', 'number' => 42),
|
array('name' => 'foo', 'number' => 42),
|
||||||
"ERROR: error {nothing}\n"
|
"ERROR: error {nothing}\n",
|
||||||
),
|
),
|
||||||
|
|
||||||
// with interpolation injection
|
// with interpolation injection
|
||||||
@@ -158,7 +158,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Logger::ERROR,
|
Mustache_Logger::ERROR,
|
||||||
'{foo}',
|
'{foo}',
|
||||||
array('foo' => '{bar}', 'bar' => 'FAIL'),
|
array('foo' => '{bar}', 'bar' => 'FAIL'),
|
||||||
"ERROR: {bar}\n"
|
"ERROR: {bar}\n",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getTokenSets
|
* @dataProvider getTokenSets
|
||||||
*/
|
*/
|
||||||
@@ -29,7 +28,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
array(),
|
array(),
|
||||||
array()
|
array(),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -49,12 +48,12 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
array(array(
|
array(array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::NAME => 'name'
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
)),
|
)),
|
||||||
array(array(
|
array(array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::NAME => 'name'
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -63,29 +62,29 @@ 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 => 'foo'
|
Mustache_Tokenizer::VALUE => 'foo',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 123,
|
Mustache_Tokenizer::INDEX => 123,
|
||||||
Mustache_Tokenizer::NAME => 'parent'
|
Mustache_Tokenizer::NAME => 'parent',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::NAME => 'name'
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 456,
|
Mustache_Tokenizer::INDEX => 456,
|
||||||
Mustache_Tokenizer::NAME => 'parent'
|
Mustache_Tokenizer::NAME => 'parent',
|
||||||
),
|
),
|
||||||
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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -93,7 +92,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 => 'foo'
|
Mustache_Tokenizer::VALUE => 'foo',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||||
@@ -105,14 +104,14 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::NAME => 'name'
|
Mustache_Tokenizer::NAME => 'name',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -131,7 +130,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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@@ -145,7 +144,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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -155,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,
|
||||||
@@ -209,7 +208,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::OTAG => '{{',
|
Mustache_Tokenizer::OTAG => '{{',
|
||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 8
|
Mustache_Tokenizer::INDEX => 8,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
||||||
@@ -217,12 +216,12 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::OTAG => '{{',
|
Mustache_Tokenizer::OTAG => '{{',
|
||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 16
|
Mustache_Tokenizer::INDEX => 16,
|
||||||
),
|
),
|
||||||
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 => 'baz'
|
Mustache_Tokenizer::VALUE => 'baz',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
@@ -230,7 +229,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::OTAG => '{{',
|
Mustache_Tokenizer::OTAG => '{{',
|
||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 19
|
Mustache_Tokenizer::INDEX => 19,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
@@ -238,8 +237,8 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::OTAG => '{{',
|
Mustache_Tokenizer::OTAG => '{{',
|
||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 27
|
Mustache_Tokenizer::INDEX => 27,
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
@@ -263,13 +262,13 @@ 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 => 'baz'
|
Mustache_Tokenizer::VALUE => 'baz',
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -284,7 +283,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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
@@ -307,11 +306,11 @@ 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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -409,7 +408,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 => 'bar'
|
Mustache_Tokenizer::VALUE => 'bar',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getTokens
|
* @dataProvider getTokens
|
||||||
*/
|
*/
|
||||||
@@ -31,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,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()
|
||||||
@@ -84,8 +83,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 10,
|
Mustache_Tokenizer::INDEX => 10,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -111,8 +110,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::CTAG => '>>>',
|
Mustache_Tokenizer::CTAG => '>>>',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 12,
|
Mustache_Tokenizer::INDEX => 12,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -179,12 +178,12 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::INDEX => 51,
|
Mustache_Tokenizer::INDEX => 51,
|
||||||
),
|
),
|
||||||
|
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 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(
|
||||||
@@ -198,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,
|
||||||
@@ -208,13 +207,13 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 9,
|
Mustache_Tokenizer::INDEX => 9,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 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,
|
||||||
@@ -227,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,
|
||||||
@@ -240,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,
|
||||||
@@ -253,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,
|
||||||
@@ -270,8 +269,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::CTAG => '%>',
|
Mustache_Tokenizer::CTAG => '%>',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 9,
|
Mustache_Tokenizer::INDEX => 9,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Ensure that $arg token is not picked up during tokenization
|
// Ensure that $arg token is not picked up during tokenization
|
||||||
@@ -285,12 +284,12 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::OTAG => '{{',
|
Mustache_Tokenizer::OTAG => '{{',
|
||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 8
|
Mustache_Tokenizer::INDEX => 8,
|
||||||
),
|
),
|
||||||
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,
|
||||||
@@ -299,8 +298,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
|||||||
Mustache_Tokenizer::CTAG => '}}',
|
Mustache_Tokenizer::CTAG => '}}',
|
||||||
Mustache_Tokenizer::LINE => 0,
|
Mustache_Tokenizer::LINE => 0,
|
||||||
Mustache_Tokenizer::INDEX => 15,
|
Mustache_Tokenizer::INDEX => 15,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+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
@@ -8,7 +8,7 @@ class DotNotation
|
|||||||
'hometown' => array(
|
'hometown' => array(
|
||||||
'city' => 'Cincinnati',
|
'city' => 'Cincinnati',
|
||||||
'state' => 'OH',
|
'state' => 'OH',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
public $normal = 'Normal';
|
public $normal = 'Normal';
|
||||||
|
|||||||
+1
-1
@@ -7,5 +7,5 @@ class DoubleSection
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public $two = "second";
|
public $two = 'second';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ class GrandParentContext
|
|||||||
{
|
{
|
||||||
$this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array(
|
$this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array(
|
||||||
array('child_id' => 'parent1-child1'),
|
array('child_id' => 'parent1-child1'),
|
||||||
array('child_id' => 'parent1-child2')
|
array('child_id' => 'parent1-child2'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$parent2 = new stdClass();
|
$parent2 = new stdClass();
|
||||||
$parent2->parent_id = 'parent2';
|
$parent2->parent_id = 'parent2';
|
||||||
$parent2->child_contexts = array(
|
$parent2->child_contexts = array(
|
||||||
array('child_id' => 'parent2-child1'),
|
array('child_id' => 'parent2-child1'),
|
||||||
array('child_id' => 'parent2-child2')
|
array('child_id' => 'parent2-child2'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->parent_contexts[] = $parent2;
|
$this->parent_contexts[] = $parent2;
|
||||||
|
|||||||
Vendored
-1
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
class I18n
|
class I18n
|
||||||
{
|
{
|
||||||
|
|
||||||
// Variable to be interpolated
|
// Variable to be interpolated
|
||||||
public $name = 'Bob';
|
public $name = 'Bob';
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ class RecursivePartials
|
|||||||
'child' => array(
|
'child' => array(
|
||||||
'name' => 'Justin',
|
'name' => 'Justin',
|
||||||
'child' => false,
|
'child' => false,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,21 +2,21 @@
|
|||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
protected $_data = array(
|
protected $_data = array(
|
||||||
'foo' => 'And it worked the second time.',
|
'foo' => 'And it worked the second time.',
|
||||||
'bar' => 'As well as the third.'
|
'bar' => 'As well as the third.',
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __get($key)
|
public function __get($key)
|
||||||
|
|||||||
@@ -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.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class SectionsNested
|
|||||||
array('name' => 'Super Macho Man'),
|
array('name' => 'Super Macho Man'),
|
||||||
array('name' => 'Piston Honda'),
|
array('name' => 'Piston Honda'),
|
||||||
array('name' => 'Mr. Sandman'),
|
array('name' => 'Mr. Sandman'),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'Mike Tyson',
|
'name' => 'Mike Tyson',
|
||||||
@@ -22,13 +22,13 @@ class SectionsNested
|
|||||||
array('name' => 'King Hippo'),
|
array('name' => 'King Hippo'),
|
||||||
array('name' => 'Great Tiger'),
|
array('name' => 'Great Tiger'),
|
||||||
array('name' => 'Glass Joe'),
|
array('name' => 'Glass Joe'),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'Don Flamenco',
|
'name' => 'Don Flamenco',
|
||||||
'enemies' => array(
|
'enemies' => array(
|
||||||
array('name' => 'Bald Bull'),
|
array('name' => 'Bald Bull'),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+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