Merge branch 'release/2.8.0'
This commit is contained in:
+2
-1
@@ -1,3 +1,4 @@
|
||||
.php_cs.cache
|
||||
composer.lock
|
||||
vendor
|
||||
mustache.php
|
||||
vendor
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
<?php
|
||||
|
||||
$config = new Symfony\CS\Config\Config();
|
||||
$config->getFinder()->in(__DIR__)->exclude('bin');
|
||||
use Symfony\CS\Config\Config;
|
||||
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;
|
||||
|
||||
@@ -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
|
||||
|
||||
before_script:
|
||||
- curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o php-cs-fixer.phar
|
||||
install:
|
||||
- curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar
|
||||
|
||||
script:
|
||||
- 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:
|
||||
- 5.2
|
||||
@@ -14,3 +14,11 @@ php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 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.
|
||||
|
||||
[](https://packagist.org/packages/mustache/mustache)
|
||||
[](http://travis-ci.org/bobthecow/mustache.php)
|
||||
[](https://packagist.org/packages/mustache/mustache)
|
||||
[](https://packagist.org/packages/mustache/mustache)
|
||||
[](http://travis-ci.org/bobthecow/mustache.php)
|
||||
[](https://packagist.org/packages/mustache/mustache)
|
||||
|
||||
|
||||
Usage
|
||||
@@ -24,9 +24,9 @@ And a more in-depth example -- this is the canonical Mustache template:
|
||||
|
||||
```html+jinja
|
||||
Hello {{name}}
|
||||
You have just won ${{value}}!
|
||||
You have just won {{value}} dollars!
|
||||
{{#in_ca}}
|
||||
Well, ${{taxed_value}}, after taxes.
|
||||
Well, {{taxed_value}} dollars, after taxes.
|
||||
{{/in_ca}}
|
||||
```
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**
|
||||
* A shell script to create a single-file class cache of the entire Mustache
|
||||
* library:
|
||||
* library.
|
||||
*
|
||||
* $ bin/build_bootstrap.php
|
||||
*
|
||||
@@ -72,7 +72,6 @@ SymfonyClassCollectionLoader::load(array(
|
||||
* the unnecessary bits removed.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class SymfonyClassCollectionLoader
|
||||
|
||||
+28
-23
@@ -2,7 +2,7 @@
|
||||
<?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
|
||||
*
|
||||
@@ -26,6 +26,7 @@ define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'
|
||||
|
||||
/**
|
||||
* transform a string to lowercase using underlines.
|
||||
*
|
||||
* Examples:
|
||||
* String -> string
|
||||
* AString -> a_string
|
||||
@@ -34,18 +35,20 @@ define('EXAMPLE_PATH', realpath(dirname(__FILE__) . '/../test/fixtures/examples'
|
||||
*
|
||||
* @param string $name
|
||||
* @access public
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getLowerCaseName($name)
|
||||
{
|
||||
return preg_replace_callback("/([A-Z])/", create_function (
|
||||
return preg_replace_callback('/([A-Z])/', create_function(
|
||||
'$match',
|
||||
'return "_" . strtolower($match[1]);'
|
||||
), lcfirst($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* transform a string to Uppercase (camelcase)
|
||||
* transform a string to Uppercase (camelcase).
|
||||
*
|
||||
* Examples
|
||||
* string -> String
|
||||
* a_string -> AString
|
||||
@@ -54,21 +57,23 @@ function getLowerCaseName($name)
|
||||
*
|
||||
* @param string $name
|
||||
* @access public
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getUpperCaseName($name)
|
||||
{
|
||||
return preg_replace_callback("/_([a-z])/", create_function (
|
||||
return preg_replace_callback('/_([a-z])/', create_function(
|
||||
'$match',
|
||||
'return strtoupper($match{1});'
|
||||
), 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
|
||||
* @access public
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
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.
|
||||
* 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 $filename filename without path and extension
|
||||
* @param string $extension extension of the file without "."
|
||||
* @access public
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function buildPath($directory, $filename = null, $extension = null)
|
||||
{
|
||||
return out(EXAMPLE_PATH . '/' . $directory.
|
||||
($extension !== null && $filename !== null ? '/' . $filename. "." . $extension : ""));
|
||||
return out(EXAMPLE_PATH . '/' . $directory .
|
||||
($extension !== null && $filename !== null ? '/' . $filename . '.' . $extension : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* creates the directory for the example
|
||||
* the script die()'s if mkdir() fails
|
||||
* creates the directory for the example.
|
||||
*
|
||||
* the script die()'s if mkdir() fails.
|
||||
*
|
||||
* @param string $directory
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function createDirectory($directory)
|
||||
{
|
||||
@@ -112,19 +119,19 @@ function createDirectory($directory)
|
||||
}
|
||||
|
||||
/**
|
||||
* create a file for the example with the given $content
|
||||
* the script die()'s if fopen() fails
|
||||
* create a file for the example with the given $content.
|
||||
*
|
||||
* the script die()'s if fopen() fails.
|
||||
*
|
||||
* @param string $directory directory without / at the end
|
||||
* @param string $filename filename without path and extension
|
||||
* @param string $extension extension of the file without "."
|
||||
* @param string $content the content of the file
|
||||
* @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) {
|
||||
fwrite($handle, $content);
|
||||
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
|
||||
* examples/some_thing
|
||||
@@ -144,16 +151,15 @@ function createFile($directory, $filename, $extension, $content = "")
|
||||
*
|
||||
* @param mixed $example_name
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function main($example_name)
|
||||
{
|
||||
$lowercase = getLowerCaseName($example_name);
|
||||
$uppercase = getUpperCaseName($example_name);
|
||||
createDirectory($lowercase);
|
||||
createFile($lowercase, $lowercase, "mustache");
|
||||
createFile($lowercase, $lowercase, "txt");
|
||||
createFile($lowercase, $uppercase, "php", <<<CONTENT
|
||||
createFile($lowercase, $lowercase, 'mustache');
|
||||
createFile($lowercase, $lowercase, 'txt');
|
||||
createFile($lowercase, $uppercase, 'php', <<<CONTENT
|
||||
<?php
|
||||
|
||||
class {$uppercase} {
|
||||
@@ -170,7 +176,6 @@ if (count($argv) > 1) {
|
||||
$example_name = $argv[1];
|
||||
|
||||
main($example_name);
|
||||
|
||||
} else {
|
||||
echo USAGE;
|
||||
}
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@
|
||||
"php": ">=5.2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*"
|
||||
"phpunit/phpunit": "~3.7|~4.0",
|
||||
"fabpot/php-cs-fixer": "~1.6"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Mustache": "src/" }
|
||||
|
||||
@@ -24,7 +24,7 @@ class Mustache_Autoloader
|
||||
public function __construct($baseDir = null)
|
||||
{
|
||||
if ($baseDir === null) {
|
||||
$baseDir = dirname(__FILE__).'/..';
|
||||
$baseDir = dirname(__FILE__) . '/..';
|
||||
}
|
||||
|
||||
// realpath doesn't always work, for example, with stream URIs
|
||||
|
||||
@@ -22,7 +22,7 @@ interface Mustache_Cache
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return boolean indicates successfully class load
|
||||
* @return bool indicates successfully class load
|
||||
*/
|
||||
public function load($key);
|
||||
|
||||
@@ -31,8 +31,6 @@ interface Mustache_Cache
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param integer $level The logging level
|
||||
* @param int $level The logging level
|
||||
* @param string $message The log message
|
||||
* @param array $context The log context
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
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 $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -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
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function writeFile($fileName, $value)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function load($key)
|
||||
{
|
||||
@@ -34,8 +34,6 @@ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cache($key, $value)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
class Mustache_Compiler
|
||||
{
|
||||
|
||||
private $pragmas;
|
||||
private $defaultPragmas = array();
|
||||
private $sections;
|
||||
@@ -264,7 +263,7 @@ class Mustache_Compiler
|
||||
|
||||
const BLOCK_ARG = '
|
||||
// %s block_arg
|
||||
$value = $this->section%s($context, $indent, true);
|
||||
$value = $this->section%s($context, \'\', true);
|
||||
$newContext[%s] = %s$value;
|
||||
';
|
||||
|
||||
@@ -342,12 +341,12 @@ class Mustache_Compiler
|
||||
$callable = $this->getCallable();
|
||||
|
||||
if ($otag !== '{{' || $ctag !== '}}') {
|
||||
$delims = ', '.var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
|
||||
$delims = ', ' . var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
|
||||
} else {
|
||||
$delims = '';
|
||||
}
|
||||
|
||||
$key = ucfirst(md5($delims."\n".$source));
|
||||
$key = ucfirst(md5($delims . "\n" . $source));
|
||||
|
||||
if (!isset($this->sections[$key])) {
|
||||
$this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $delims, $this->walk($nodes, 2));
|
||||
@@ -458,7 +457,7 @@ class Mustache_Compiler
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@@ -475,7 +474,7 @@ class Mustache_Compiler
|
||||
*
|
||||
* @param string $id Variable name
|
||||
* @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
|
||||
*
|
||||
* @return string Generated variable interpolation PHP source
|
||||
@@ -546,14 +545,14 @@ class Mustache_Compiler
|
||||
*
|
||||
* @param string $text
|
||||
* @param int $bonus Additional indent level (default: 0)
|
||||
* @param boolean $prependNewline Prepend a newline to the snippet? (default: true)
|
||||
* @param boolean $appendNewline Append a newline to the snippet? (default: false)
|
||||
* @param bool $prependNewline Prepend a newline to the snippet? (default: true)
|
||||
* @param bool $appendNewline Append a newline to the snippet? (default: false)
|
||||
*
|
||||
* @return string PHP source code snippet
|
||||
*/
|
||||
private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
|
||||
{
|
||||
$text = ($prependNewline ? "\n" : '').trim($text);
|
||||
$text = ($prependNewline ? "\n" : '') . trim($text);
|
||||
if ($prependNewline) {
|
||||
$bonus++;
|
||||
}
|
||||
@@ -561,7 +560,7 @@ class Mustache_Compiler
|
||||
$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)';
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
class Mustache_Engine
|
||||
{
|
||||
const VERSION = '2.7.0';
|
||||
const VERSION = '2.8.0';
|
||||
const SPEC_VERSION = '1.1.2';
|
||||
|
||||
const PRAGMA_FILTERS = 'FILTERS';
|
||||
@@ -405,7 +405,7 @@ class Mustache_Engine
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return boolean True if the helper is present
|
||||
* @return bool True if the helper is present
|
||||
*/
|
||||
public function hasHelper($name)
|
||||
{
|
||||
@@ -772,7 +772,7 @@ class Mustache_Engine
|
||||
/**
|
||||
* 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 array $context The log context
|
||||
*/
|
||||
|
||||
@@ -103,7 +103,7 @@ class Mustache_HelperCollection
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return boolean True if helper is present
|
||||
* @return bool True if helper is present
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ class Mustache_HelperCollection
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return boolean True if helper is present
|
||||
* @return bool True if helper is present
|
||||
*/
|
||||
public function has($name)
|
||||
{
|
||||
@@ -163,7 +163,7 @@ class Mustache_HelperCollection
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ class Mustache_Loader_CascadingLoader implements Mustache_Loader
|
||||
private $loaders;
|
||||
|
||||
/**
|
||||
* Construct a CascadingLoader with an array of loaders:
|
||||
* Construct a CascadingLoader with an array of loaders.
|
||||
*
|
||||
* $loader = new Mustache_Loader_CascadingLoader(array(
|
||||
* new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
*
|
||||
* @@ hello
|
||||
* Hello, {{ name }}!
|
||||
*
|
||||
*/
|
||||
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 magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually
|
||||
* perfectly suited to the job:
|
||||
*
|
||||
|
||||
@@ -18,8 +18,6 @@ interface Mustache_Loader_MutableLoader
|
||||
* Set an associative array of Template sources for this loader.
|
||||
*
|
||||
* @param array $templates
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTemplates(array $templates);
|
||||
|
||||
@@ -28,8 +26,6 @@ interface Mustache_Loader_MutableLoader
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $template Mustache Template source
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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.
|
||||
*
|
||||
@@ -29,7 +29,7 @@
|
||||
interface Mustache_Logger
|
||||
{
|
||||
/**
|
||||
* Psr\Log compatible log levels
|
||||
* Psr\Log compatible log levels.
|
||||
*/
|
||||
const EMERGENCY = 'emergency';
|
||||
const ALERT = 'alert';
|
||||
@@ -45,8 +45,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array());
|
||||
|
||||
@@ -58,8 +56,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array());
|
||||
|
||||
@@ -70,8 +66,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array());
|
||||
|
||||
@@ -81,8 +75,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array());
|
||||
|
||||
@@ -94,8 +86,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array());
|
||||
|
||||
@@ -104,8 +94,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array());
|
||||
|
||||
@@ -116,8 +104,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array());
|
||||
|
||||
@@ -126,8 +112,6 @@ interface Mustache_Logger
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array());
|
||||
|
||||
@@ -137,8 +121,6 @@ interface Mustache_Logger
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
||||
/**
|
||||
* Get the current minimum logging level.
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
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_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 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.
|
||||
*
|
||||
* @param integer $level
|
||||
* @param int $level
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -153,7 +153,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
||||
/**
|
||||
* 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 array $context The log context
|
||||
*
|
||||
|
||||
@@ -254,7 +254,7 @@ class Mustache_Parser
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ abstract class Mustache_Template
|
||||
protected $mustache;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
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;
|
||||
* $tpl = $m->loadTemplate('Hello, {{ name }}!');
|
||||
@@ -109,7 +109,7 @@ abstract class Mustache_Template
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return boolean True if the value is 'iterable'
|
||||
* @return bool True if the value is 'iterable'
|
||||
*/
|
||||
protected function isIterable($value)
|
||||
{
|
||||
|
||||
@@ -53,13 +53,6 @@ class Mustache_Tokenizer
|
||||
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
|
||||
const TYPE = 'type';
|
||||
const NAME = 'name';
|
||||
@@ -75,7 +68,6 @@ class Mustache_Tokenizer
|
||||
|
||||
private $state;
|
||||
private $tagType;
|
||||
private $tag;
|
||||
private $buffer;
|
||||
private $tokens;
|
||||
private $seenTag;
|
||||
@@ -163,7 +155,7 @@ class Mustache_Tokenizer
|
||||
self::OTAG => $this->otag,
|
||||
self::CTAG => $this->ctag,
|
||||
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) {
|
||||
@@ -224,7 +216,6 @@ class Mustache_Tokenizer
|
||||
{
|
||||
$this->state = self::IN_TEXT;
|
||||
$this->tagType = null;
|
||||
$this->tag = null;
|
||||
$this->buffer = '';
|
||||
$this->tokens = array();
|
||||
$this->seenTag = false;
|
||||
@@ -244,7 +235,7 @@ class Mustache_Tokenizer
|
||||
$this->tokens[] = array(
|
||||
self::TYPE => self::T_TEXT,
|
||||
self::LINE => $this->line,
|
||||
self::VALUE => $this->buffer
|
||||
self::VALUE => $this->buffer,
|
||||
);
|
||||
$this->buffer = '';
|
||||
}
|
||||
@@ -261,7 +252,7 @@ class Mustache_Tokenizer
|
||||
private function changeDelimiters($text, $index)
|
||||
{
|
||||
$startIndex = strpos($text, '=', $index) + 1;
|
||||
$close = '='.$this->ctag;
|
||||
$close = '=' . $this->ctag;
|
||||
$closeIndex = strpos($text, $close, $index);
|
||||
|
||||
$this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex)));
|
||||
@@ -322,7 +313,7 @@ class Mustache_Tokenizer
|
||||
* @param string $text Mustache template source
|
||||
* @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)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ class Mustache_Test_AutoloaderTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testAutoloader()
|
||||
{
|
||||
$loader = new Mustache_Autoloader(dirname(__FILE__).'/../../fixtures/autoloader');
|
||||
$loader = new Mustache_Autoloader(dirname(__FILE__) . '/../../fixtures/autoloader');
|
||||
|
||||
$this->assertNull($loader->autoload('NonMustacheClass'));
|
||||
$this->assertFalse(class_exists('NonMustacheClass'));
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider getCompileValues
|
||||
*/
|
||||
@@ -48,7 +47,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
)
|
||||
),
|
||||
),
|
||||
'Monkey',
|
||||
true,
|
||||
@@ -59,7 +58,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
||||
'$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
|
||||
'return $buffer;',
|
||||
)
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -68,7 +67,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
)
|
||||
),
|
||||
),
|
||||
'Monkey',
|
||||
false,
|
||||
@@ -77,9 +76,9 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
"\nclass Monkey extends Mustache_Template",
|
||||
'$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;',
|
||||
)
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -88,7 +87,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
)
|
||||
),
|
||||
),
|
||||
'Monkey',
|
||||
false,
|
||||
@@ -97,9 +96,9 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
"\nclass Monkey extends Mustache_Template",
|
||||
'$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;',
|
||||
)
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -124,11 +123,11 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
||||
"\nclass Monkey extends Mustache_Template",
|
||||
"\$buffer .= \$indent . 'foo\n';",
|
||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
||||
'$buffer .= htmlspecialchars($value, '.ENT_COMPAT.', \'UTF-8\');',
|
||||
'$buffer .= htmlspecialchars($value, ' . ENT_COMPAT . ', \'UTF-8\');',
|
||||
'$value = $this->resolveValue($context->last(), $context, $indent);',
|
||||
'$buffer .= \'\\\'bar\\\'\';',
|
||||
'return $buffer;',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$two = new Mustache_Context(array(
|
||||
'foo' => 'FOO',
|
||||
'bar' => '<BAR>'
|
||||
'bar' => '<BAR>',
|
||||
));
|
||||
$this->assertEquals('FOO', $two->find('foo'));
|
||||
$this->assertEquals('<BAR>', $two->find('bar'));
|
||||
|
||||
@@ -151,7 +151,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
||||
public function testWithoutLambdaCache()
|
||||
{
|
||||
$mustache = new MustacheStub(array(
|
||||
'cache' => self::$tempDir
|
||||
'cache' => self::$tempDir,
|
||||
));
|
||||
|
||||
$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(
|
||||
'foo' => 'FOO',
|
||||
'baz' => 'BAZ',
|
||||
))
|
||||
)),
|
||||
));
|
||||
|
||||
$this->assertEquals('FOOBAZ', $mustache->render('{{>foo}}{{>bar}}{{>baz}}', array()));
|
||||
@@ -237,7 +237,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
||||
|
||||
public static function wrapWithUnderscores($text)
|
||||
{
|
||||
return '__'.$text.'__';
|
||||
return '__' . $text . '__';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,7 +317,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
||||
list($name, $mustache) = $this->getLoggedMustache(Mustache_Logger::DEBUG);
|
||||
$mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO'));
|
||||
$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);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
||||
public function testUnknownPragmaThrowsException()
|
||||
{
|
||||
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');
|
||||
$mustache = new Mustache_Engine(array(
|
||||
'logger' => new Mustache_Logger_StreamLogger($name, $level)
|
||||
'logger' => new Mustache_Logger_StreamLogger($name, $level),
|
||||
));
|
||||
|
||||
return array($name, $mustache);
|
||||
|
||||
@@ -33,7 +33,7 @@ class Mustache_Test_FiveThree_Functional_EngineTest extends PHPUnit_Framework_Te
|
||||
$helpers = array(
|
||||
'longdate' => function (\DateTime $value) {
|
||||
return $value->format('Y-m-d h:m:s');
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
$data = array(
|
||||
@@ -44,7 +44,7 @@ class Mustache_Test_FiveThree_Functional_EngineTest extends PHPUnit_Framework_Te
|
||||
|
||||
return array(
|
||||
array(array(Mustache_Engine::PRAGMA_FILTERS), $helpers, $data, $tpl, '2000-01-01 12:01:00'),
|
||||
array(array(), $helpers, $data, $tpl, '' ),
|
||||
array(array(), $helpers, $data, $tpl, ''),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
||||
array(
|
||||
'{{% FILTERS }}{{ date | longdate }}',
|
||||
$helpers,
|
||||
(object) array('date' => new DateTime('1/1/2000', new DateTimeZone("UTC"))),
|
||||
'2000-01-01 12:01:00'
|
||||
(object) array('date' => new DateTime('1/1/2000', new DateTimeZone('UTC'))),
|
||||
'2000-01-01 12:01:00',
|
||||
),
|
||||
|
||||
array(
|
||||
'{{% FILTERS }}{{# word | echo }}{{ . }}!{{/ word | echo }}',
|
||||
$helpers,
|
||||
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->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));
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
|
||||
'name' => 'Bob',
|
||||
'wrap' => function ($text) {
|
||||
return sprintf('[[%s]]', $text);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
$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 functional
|
||||
@@ -23,7 +23,7 @@ class Mustache_Test_FiveThree_Functional_MustacheSpecTest extends Mustache_Test_
|
||||
*/
|
||||
public function testSpecInitialized()
|
||||
{
|
||||
if (!file_exists(dirname(__FILE__).'/../../../../../vendor/spec/specs/')) {
|
||||
if (!file_exists(dirname(__FILE__) . '/../../../../../vendor/spec/specs/')) {
|
||||
$this->markTestSkipped('Mustache spec submodule not initialized: run "git submodule update --init"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
class Mustache_Test_FiveThree_Functional_PartialLambdaIndentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testLambdasInsidePartialsAreIndentedProperly()
|
||||
{
|
||||
$src = <<<EOS
|
||||
@@ -37,7 +36,7 @@ EOS;
|
||||
EOS;
|
||||
|
||||
$m = new Mustache_Engine(array(
|
||||
'partials' => array('input' => $partial)
|
||||
'partials' => array('input' => $partial),
|
||||
));
|
||||
|
||||
$tpl = $m->loadTemplate($src);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testCallEatsContext()
|
||||
{
|
||||
$m = new Mustache_Engine();
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$mustache = new Mustache_Engine(array(
|
||||
'partials' => $partials
|
||||
'partials' => $partials,
|
||||
));
|
||||
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
|
||||
}
|
||||
@@ -47,16 +46,16 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function getExamples()
|
||||
{
|
||||
$path = realpath(dirname(__FILE__).'/../../../fixtures/examples');
|
||||
$path = realpath(dirname(__FILE__) . '/../../../fixtures/examples');
|
||||
$examples = array();
|
||||
|
||||
$handle = opendir($path);
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if ($file == '.' || $file == '..') {
|
||||
if ($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullpath = $path.'/'.$file;
|
||||
$fullpath = $path . '/' . $file;
|
||||
if (is_dir($fullpath)) {
|
||||
$examples[$file] = $this->loadExample($fullpath);
|
||||
}
|
||||
@@ -82,10 +81,10 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$handle = opendir($path);
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$fullpath = $path.'/'.$file;
|
||||
$fullpath = $path . '/' . $file;
|
||||
$info = pathinfo($fullpath);
|
||||
|
||||
if (is_dir($fullpath) && $info['basename'] == 'partials') {
|
||||
if (is_dir($fullpath) && $info['basename'] === 'partials') {
|
||||
// load partials
|
||||
$partials = $this->loadPartials($fullpath);
|
||||
} elseif (is_file($fullpath)) {
|
||||
@@ -125,11 +124,11 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$handle = opendir($path);
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if ($file == '.' || $file == '..') {
|
||||
if ($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullpath = $path.'/'.$file;
|
||||
$fullpath = $path . '/' . $file;
|
||||
$info = pathinfo($fullpath);
|
||||
|
||||
if ($info['extension'] === 'mustache') {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* @group inheritance
|
||||
* @group functional
|
||||
*/
|
||||
|
||||
class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $mustache;
|
||||
@@ -24,13 +23,13 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
'foo' => '{{$baz}}default content{{/baz}}',
|
||||
),
|
||||
array(
|
||||
'bar' => 'set by user'
|
||||
'bar' => 'set by user',
|
||||
),
|
||||
'{{< foo }}{{# bar }}{{$ baz }}{{/ baz }}{{/ bar }}{{/ foo }}',
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'foo' => '{{$baz}}default content{{/baz}}'
|
||||
'foo' => '{{$baz}}default content{{/baz}}',
|
||||
),
|
||||
array(
|
||||
),
|
||||
@@ -39,19 +38,19 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
array(
|
||||
array(
|
||||
'foo' => '{{$baz}}default content{{/baz}}',
|
||||
'qux' => 'I am a partial'
|
||||
'qux' => 'I am a partial',
|
||||
),
|
||||
array(
|
||||
),
|
||||
'{{<foo}}{{>qux}}{{$baz}}set by template{{/baz}}{{/foo}}'
|
||||
'{{<foo}}{{>qux}}{{$baz}}set by template{{/baz}}{{/foo}}',
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'foo' => '{{$baz}}default content{{/baz}}'
|
||||
'foo' => '{{$baz}}default content{{/baz}}',
|
||||
),
|
||||
array(),
|
||||
'{{<foo}}{{=<% %>=}}<%={{ }}=%>{{/foo}}'
|
||||
)
|
||||
'{{<foo}}{{=<% %>=}}<%={{ }}=%>{{/foo}}',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,28 +62,28 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
'foo' => '{{$baz}}default content{{/baz}}',
|
||||
),
|
||||
array(
|
||||
'bar' => 'set by user'
|
||||
'bar' => 'set by user',
|
||||
),
|
||||
'{{<foo}}{{bar}}{{$baz}}override{{/baz}}{{/foo}}',
|
||||
'override'
|
||||
'override',
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'foo' => '{{$baz}}default content{{/baz}}'
|
||||
'foo' => '{{$baz}}default content{{/baz}}',
|
||||
),
|
||||
array(
|
||||
),
|
||||
'{{<foo}}{{! ignore me }}{{$baz}}set by template{{/baz}}{{/foo}}',
|
||||
'set by template'
|
||||
'set by template',
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'foo' => '{{$baz}}defualt content{{/baz}}'
|
||||
'foo' => '{{$baz}}defualt content{{/baz}}',
|
||||
),
|
||||
array(),
|
||||
'{{<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}}');
|
||||
|
||||
$data = array(
|
||||
'bar' => 'baz'
|
||||
'bar' => 'baz',
|
||||
);
|
||||
|
||||
$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}}');
|
||||
|
||||
$data = array(
|
||||
'bar' => '<baz>'
|
||||
'bar' => '<baz>',
|
||||
);
|
||||
|
||||
$this->assertEquals('default <baz> content', $tpl->render($data));
|
||||
@@ -126,7 +125,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
);
|
||||
|
||||
$data = array(
|
||||
'bar' => array('baz' => 'qux')
|
||||
'bar' => array('baz' => 'qux'),
|
||||
);
|
||||
|
||||
$this->assertEquals('default qux content', $tpl->render($data));
|
||||
@@ -140,11 +139,10 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
|
||||
$data = array(
|
||||
'foo' => array('bar' => 'qux'),
|
||||
'baz' => 'three'
|
||||
'baz' => 'three',
|
||||
);
|
||||
|
||||
$this->assertEquals('default three content', $tpl->render($data));
|
||||
|
||||
}
|
||||
|
||||
public function testMustacheInjectionInDefaultContent()
|
||||
@@ -154,7 +152,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
);
|
||||
|
||||
$data = array(
|
||||
'bar' => array('baz' => '{{qux}}')
|
||||
'bar' => array('baz' => '{{qux}}'),
|
||||
);
|
||||
|
||||
$this->assertEquals('default {{qux}} content', $tpl->render($data));
|
||||
@@ -163,7 +161,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testDefaultContentRenderedInsideIncludedTemplates()
|
||||
{
|
||||
$partials = array(
|
||||
'include' => '{{$foo}}default content{{/foo}}'
|
||||
'include' => '{{$foo}}default content{{/foo}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -180,7 +178,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testOverriddenContent()
|
||||
{
|
||||
$partials = array(
|
||||
'super' => '...{{$title}}Default title{{/title}}...'
|
||||
'super' => '...{{$title}}Default title{{/title}}...',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -197,7 +195,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testOverriddenPartial()
|
||||
{
|
||||
$partials = array(
|
||||
'partial' => '|{{$stuff}}...{{/stuff}}{{$default}} default{{/default}}|'
|
||||
'partial' => '|{{$stuff}}...{{/stuff}}{{$default}} default{{/default}}|',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -214,7 +212,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testDataDoesNotOverrideBlock()
|
||||
{
|
||||
$partials = array(
|
||||
'include' => '{{$var}}var in include{{/var}}'
|
||||
'include' => '{{$var}}var in include{{/var}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -224,7 +222,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
);
|
||||
|
||||
$data = array(
|
||||
'var' => 'var in data'
|
||||
'var' => 'var in 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()
|
||||
{
|
||||
$partials = array(
|
||||
'include' => '{{$var}}var in include{{/var}}'
|
||||
'include' => '{{$var}}var in include{{/var}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -243,7 +241,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
);
|
||||
|
||||
$data = array(
|
||||
'var' => 'var in data'
|
||||
'var' => 'var in 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()
|
||||
{
|
||||
$partials = array(
|
||||
'partial' => '{{$ballmer}}peaking{{/ballmer}}'
|
||||
'partial' => '{{$ballmer}}peaking{{/ballmer}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -269,9 +267,8 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testInheritIndentationWhenOverridingAPartial()
|
||||
{
|
||||
$partials = array(
|
||||
'partial' =>
|
||||
'stop:
|
||||
{{$nineties}}collaborate and listen{{/nineties}}'
|
||||
'partial' => 'stop:
|
||||
{{$nineties}}collaborate and listen{{/nineties}}',
|
||||
);
|
||||
|
||||
$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()
|
||||
{
|
||||
$partials = array(
|
||||
'partial' => '{{$stuff}}default one{{/stuff}}, {{$stuff2}}default two{{/stuff2}}'
|
||||
'partial' => '{{$stuff}}default one{{/stuff}}, {{$stuff2}}default two{{/stuff2}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -309,7 +329,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testSuperTemplatesWithNoParameters()
|
||||
{
|
||||
$partials = array(
|
||||
'include' => '{{$foo}}default content{{/foo}}'
|
||||
'include' => '{{$foo}}default content{{/foo}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -327,7 +347,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
{
|
||||
$partials = array(
|
||||
'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);
|
||||
@@ -346,7 +366,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
$partials = array(
|
||||
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
||||
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
||||
'grandParent' => '{{$a}}g{{/a}}'
|
||||
'grandParent' => '{{$a}}g{{/a}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -365,7 +385,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
$partials = array(
|
||||
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
||||
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
||||
'grandParent' => '{{$a}}g{{/a}}'
|
||||
'grandParent' => '{{$a}}g{{/a}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -382,7 +402,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testIgnoreTextInsideSuperTemplatesButParseArgs()
|
||||
{
|
||||
$partials = array(
|
||||
'include' => '{{$foo}}default content{{/foo}}'
|
||||
'include' => '{{$foo}}default content{{/foo}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
@@ -399,7 +419,7 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
|
||||
public function testIgnoreTextInsideSuperTemplates()
|
||||
{
|
||||
$partials = array(
|
||||
'include' => '{{$foo}}default content{{/foo}}'
|
||||
'include' => '{{$foo}}default content{{/foo}}',
|
||||
);
|
||||
|
||||
$this->mustache->setPartials($partials);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $mustache;
|
||||
|
||||
public function setUp()
|
||||
@@ -36,25 +35,25 @@ class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_T
|
||||
{
|
||||
$interpolationData = array(
|
||||
'a' => '{{ b }}',
|
||||
'b' => 'FAIL'
|
||||
'b' => 'FAIL',
|
||||
);
|
||||
|
||||
$sectionData = array(
|
||||
'a' => true,
|
||||
'b' => '{{ c }}',
|
||||
'c' => 'FAIL'
|
||||
'c' => 'FAIL',
|
||||
);
|
||||
|
||||
$lambdaInterpolationData = array(
|
||||
'a' => array($this, 'lambdaInterpolationCallback'),
|
||||
'b' => '{{ c }}',
|
||||
'c' => 'FAIL'
|
||||
'c' => 'FAIL',
|
||||
);
|
||||
|
||||
$lambdaSectionData = array(
|
||||
'a' => array($this, 'lambdaSectionCallback'),
|
||||
'b' => '{{ c }}',
|
||||
'c' => 'FAIL'
|
||||
'c' => 'FAIL',
|
||||
);
|
||||
|
||||
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 functional
|
||||
@@ -23,7 +23,7 @@ class Mustache_Test_Functional_MustacheSpecTest extends Mustache_Test_SpecTestCa
|
||||
*/
|
||||
public function testSpecInitialized()
|
||||
{
|
||||
if (!file_exists(dirname(__FILE__).'/../../../../vendor/spec/specs/')) {
|
||||
if (!file_exists(dirname(__FILE__) . '/../../../../vendor/spec/specs/')) {
|
||||
$this->markTestSkipped('Mustache spec submodule not initialized: run "git submodule update --init"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class Mustache_Test_Functional_NestedPartialIndentTest extends PHPUnit_Framework
|
||||
public function testNestedPartialsAreIndentedProperly($src, array $partials, $expected)
|
||||
{
|
||||
$m = new Mustache_Engine(array(
|
||||
'partials' => $partials
|
||||
'partials' => $partials,
|
||||
));
|
||||
$tpl = $m->loadTemplate($src);
|
||||
$this->assertEquals($expected, $tpl->render());
|
||||
|
||||
@@ -26,14 +26,14 @@ abstract class Mustache_Test_FunctionalTestCase extends PHPUnit_Framework_TestCa
|
||||
*/
|
||||
protected static function rmdir($path)
|
||||
{
|
||||
$path = rtrim($path, '/').'/';
|
||||
$path = rtrim($path, '/') . '/';
|
||||
$handle = opendir($path);
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if ($file == '.' || $file == '..') {
|
||||
if ($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullpath = $path.$file;
|
||||
$fullpath = $path . $file;
|
||||
if (is_dir($fullpath)) {
|
||||
self::rmdir($fullpath);
|
||||
} else {
|
||||
|
||||
@@ -17,7 +17,7 @@ class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
|
||||
public function testConstructor()
|
||||
{
|
||||
$loader = new Mustache_Loader_ArrayLoader(array(
|
||||
'foo' => 'bar'
|
||||
'foo' => 'bar',
|
||||
));
|
||||
|
||||
$this->assertEquals('bar', $loader->load('foo'));
|
||||
@@ -26,7 +26,7 @@ class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
|
||||
public function testSetAndLoadTemplates()
|
||||
{
|
||||
$loader = new Mustache_Loader_ArrayLoader(array(
|
||||
'foo' => 'bar'
|
||||
'foo' => 'bar',
|
||||
));
|
||||
$this->assertEquals('bar', $loader->load('foo'));
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
|
||||
{
|
||||
public function testConstructor()
|
||||
{
|
||||
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
|
||||
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => '.ms'));
|
||||
$this->assertEquals('alpha contents', $loader->load('alpha'));
|
||||
$this->assertEquals('beta contents', $loader->load('beta.ms'));
|
||||
@@ -24,14 +24,14 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
|
||||
|
||||
public function testTrailingSlashes()
|
||||
{
|
||||
$baseDir = dirname(__FILE__).'/../../../fixtures/templates/';
|
||||
$baseDir = dirname(__FILE__) . '/../../../fixtures/templates/';
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
||||
$this->assertEquals('one contents', $loader->load('one'));
|
||||
}
|
||||
|
||||
public function testConstructorWithProtocol()
|
||||
{
|
||||
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
|
||||
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
||||
|
||||
$loader = new Mustache_Loader_FilesystemLoader('file://' . $baseDir, array('extension' => '.ms'));
|
||||
$this->assertEquals('alpha contents', $loader->load('alpha'));
|
||||
@@ -40,7 +40,7 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
|
||||
|
||||
public function testLoadTemplates()
|
||||
{
|
||||
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
|
||||
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
||||
$this->assertEquals('one contents', $loader->load('one'));
|
||||
$this->assertEquals('two contents', $loader->load('two.mustache'));
|
||||
@@ -48,7 +48,7 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
|
||||
|
||||
public function testEmptyExtensionString()
|
||||
{
|
||||
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
|
||||
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
||||
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => ''));
|
||||
$this->assertEquals('one contents', $loader->load('one.mustache'));
|
||||
@@ -64,7 +64,7 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
|
||||
*/
|
||||
public function testMissingBaseDirThrowsException()
|
||||
{
|
||||
new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/not_a_directory');
|
||||
new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/not_a_directory');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa
|
||||
*/
|
||||
public function testMissingTemplateThrowsException()
|
||||
{
|
||||
$baseDir = realpath(dirname(__FILE__).'/../../../fixtures/templates');
|
||||
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
||||
|
||||
$loader->load('fake');
|
||||
|
||||
@@ -55,13 +55,13 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$stream = tmpfile();
|
||||
$logger = new Mustache_Logger_StreamLogger($stream, $logLevel);
|
||||
$logger->log($level, "logged");
|
||||
$logger->log($level, 'logged');
|
||||
|
||||
rewind($stream);
|
||||
$result = fread($stream, 1024);
|
||||
|
||||
if ($shouldLog) {
|
||||
$this->assertContains("logged", $result);
|
||||
$this->assertContains('logged', $result);
|
||||
} else {
|
||||
$this->assertEmpty($result);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Logger::ERROR,
|
||||
'error message',
|
||||
array('name' => 'foo', 'number' => 42),
|
||||
"ERROR: error message\n"
|
||||
"ERROR: error message\n",
|
||||
),
|
||||
|
||||
// with interpolation
|
||||
@@ -142,7 +142,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Logger::ERROR,
|
||||
'error {name}-{number}',
|
||||
array('name' => 'foo', 'number' => 42),
|
||||
"ERROR: error foo-42\n"
|
||||
"ERROR: error foo-42\n",
|
||||
),
|
||||
|
||||
// with iterpolation false positive
|
||||
@@ -150,7 +150,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Logger::ERROR,
|
||||
'error {nothing}',
|
||||
array('name' => 'foo', 'number' => 42),
|
||||
"ERROR: error {nothing}\n"
|
||||
"ERROR: error {nothing}\n",
|
||||
),
|
||||
|
||||
// with interpolation injection
|
||||
@@ -158,7 +158,7 @@ class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Logger::ERROR,
|
||||
'{foo}',
|
||||
array('foo' => '{bar}', 'bar' => 'FAIL'),
|
||||
"ERROR: {bar}\n"
|
||||
"ERROR: {bar}\n",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider getTokenSets
|
||||
*/
|
||||
@@ -29,7 +28,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
return array(
|
||||
array(
|
||||
array(),
|
||||
array()
|
||||
array(),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -49,12 +48,12 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
array(array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
)),
|
||||
array(array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
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(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'foo'
|
||||
Mustache_Tokenizer::VALUE => 'foo',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::NAME => 'parent'
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 456,
|
||||
Mustache_Tokenizer::NAME => 'parent'
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
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(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'foo'
|
||||
Mustache_Tokenizer::VALUE => 'foo',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||
@@ -105,14 +104,14 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
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(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'bar'
|
||||
Mustache_Tokenizer::VALUE => 'bar',
|
||||
),
|
||||
),
|
||||
array(
|
||||
@@ -145,7 +144,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
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(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => " ",
|
||||
Mustache_Tokenizer::VALUE => ' ',
|
||||
),
|
||||
array(
|
||||
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::CTAG => '}}',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 8
|
||||
Mustache_Tokenizer::INDEX => 8,
|
||||
),
|
||||
array(
|
||||
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::CTAG => '}}',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 16
|
||||
Mustache_Tokenizer::INDEX => 16,
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'baz'
|
||||
Mustache_Tokenizer::VALUE => 'baz',
|
||||
),
|
||||
array(
|
||||
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::CTAG => '}}',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 19
|
||||
Mustache_Tokenizer::INDEX => 19,
|
||||
),
|
||||
array(
|
||||
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::CTAG => '}}',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 27
|
||||
)
|
||||
Mustache_Tokenizer::INDEX => 27,
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
@@ -263,13 +262,13 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'baz'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
Mustache_Tokenizer::VALUE => 'baz',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -284,7 +283,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'bar'
|
||||
Mustache_Tokenizer::VALUE => 'bar',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
@@ -307,11 +306,11 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
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(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => 'bar'
|
||||
Mustache_Tokenizer::VALUE => 'bar',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider getTokens
|
||||
*/
|
||||
@@ -31,7 +30,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$tokenizer = new Mustache_Tokenizer();
|
||||
|
||||
$text = "{{{ name }}";
|
||||
$text = '{{{ name }}';
|
||||
$tokenizer->scan($text, null);
|
||||
}
|
||||
|
||||
@@ -42,8 +41,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$tokenizer = new Mustache_Tokenizer();
|
||||
|
||||
$text = "<%{ name %>";
|
||||
$tokenizer->scan($text, "<% %>");
|
||||
$text = '<%{ name %>';
|
||||
$tokenizer->scan($text, '<% %>');
|
||||
}
|
||||
|
||||
public function getTokens()
|
||||
@@ -84,8 +83,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Tokenizer::CTAG => '}}',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 10,
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -111,8 +110,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Tokenizer::CTAG => '>>>',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 12,
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -179,12 +178,12 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Tokenizer::INDEX => 51,
|
||||
),
|
||||
|
||||
)
|
||||
),
|
||||
),
|
||||
|
||||
// See https://github.com/bobthecow/mustache.php/issues/183
|
||||
array(
|
||||
"{{# a }}0{{/ a }}",
|
||||
'{{# a }}0{{/ a }}',
|
||||
null,
|
||||
array(
|
||||
array(
|
||||
@@ -198,7 +197,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => "0",
|
||||
Mustache_Tokenizer::VALUE => '0',
|
||||
),
|
||||
array(
|
||||
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::INDEX => 9,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
|
||||
// custom delimiters don't swallow the next character, even if it is a }, }}}, or the same delimiter
|
||||
array(
|
||||
"<% a %>} <% b %>%> <% c %>}}}",
|
||||
"<% %>",
|
||||
'<% a %>} <% b %>%> <% c %>}}}',
|
||||
'<% %>',
|
||||
array(
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
@@ -227,7 +226,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => "} ",
|
||||
Mustache_Tokenizer::VALUE => '} ',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
@@ -240,7 +239,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => "%> ",
|
||||
Mustache_Tokenizer::VALUE => '%> ',
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
@@ -253,15 +252,15 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => "}}}",
|
||||
Mustache_Tokenizer::VALUE => '}}}',
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
// unescaped custom delimiters are properly parsed
|
||||
array(
|
||||
"<%{ a }%>",
|
||||
"<% %>",
|
||||
'<%{ a }%>',
|
||||
'<% %>',
|
||||
array(
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
||||
@@ -270,8 +269,8 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
||||
Mustache_Tokenizer::CTAG => '%>',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 9,
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 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::CTAG => '}}',
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 8
|
||||
Mustache_Tokenizer::INDEX => 8,
|
||||
),
|
||||
array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
||||
Mustache_Tokenizer::LINE => 0,
|
||||
Mustache_Tokenizer::VALUE => "default",
|
||||
Mustache_Tokenizer::VALUE => 'default',
|
||||
),
|
||||
array(
|
||||
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::LINE => 0,
|
||||
Mustache_Tokenizer::INDEX => 15,
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,15 +2,15 @@
|
||||
|
||||
class Delimiters
|
||||
{
|
||||
public $start = "It worked the first time.";
|
||||
public $start = 'It worked the first time.';
|
||||
|
||||
public function middle()
|
||||
{
|
||||
return array(
|
||||
array('item' => "And it worked the second time."),
|
||||
array('item' => "As well as the third."),
|
||||
array('item' => 'And it worked the second time.'),
|
||||
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(
|
||||
'city' => 'Cincinnati',
|
||||
'state' => 'OH',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
public $normal = 'Normal';
|
||||
|
||||
+1
-1
@@ -7,5 +7,5 @@ class DoubleSection
|
||||
return true;
|
||||
}
|
||||
|
||||
public $two = "second";
|
||||
public $two = 'second';
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ class GrandParentContext
|
||||
{
|
||||
$this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array(
|
||||
array('child_id' => 'parent1-child1'),
|
||||
array('child_id' => 'parent1-child2')
|
||||
array('child_id' => 'parent1-child2'),
|
||||
));
|
||||
|
||||
$parent2 = new stdClass();
|
||||
$parent2->parent_id = 'parent2';
|
||||
$parent2->child_contexts = array(
|
||||
array('child_id' => 'parent2-child1'),
|
||||
array('child_id' => 'parent2-child2')
|
||||
array('child_id' => 'parent2-child2'),
|
||||
);
|
||||
|
||||
$this->parent_contexts[] = $parent2;
|
||||
|
||||
Vendored
-1
@@ -2,7 +2,6 @@
|
||||
|
||||
class I18n
|
||||
{
|
||||
|
||||
// Variable to be interpolated
|
||||
public $name = 'Bob';
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ class RecursivePartials
|
||||
'child' => array(
|
||||
'name' => 'Justin',
|
||||
'child' => false,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class SectionIteratorObjects
|
||||
{
|
||||
public $start = "It worked the first time.";
|
||||
public $start = 'It worked the first time.';
|
||||
|
||||
protected $_data = array(
|
||||
array('item' => 'And it worked the second time.'),
|
||||
@@ -14,5 +14,5 @@ class SectionIteratorObjects
|
||||
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
|
||||
{
|
||||
public $start = "It worked the first time.";
|
||||
public $start = 'It worked the first time.';
|
||||
|
||||
public function middle()
|
||||
{
|
||||
return new MagicObject();
|
||||
}
|
||||
|
||||
public $final = "Then, surprisingly, it worked the final time.";
|
||||
public $final = 'Then, surprisingly, it worked the final time.';
|
||||
}
|
||||
|
||||
class MagicObject
|
||||
{
|
||||
protected $_data = array(
|
||||
'foo' => 'And it worked the second time.',
|
||||
'bar' => 'As well as the third.'
|
||||
'bar' => 'As well as the third.',
|
||||
);
|
||||
|
||||
public function __get($key)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
class SectionObjects
|
||||
{
|
||||
public $start = "It worked the first time.";
|
||||
public $start = 'It worked the first time.';
|
||||
|
||||
public function middle()
|
||||
{
|
||||
return new SectionObject();
|
||||
}
|
||||
|
||||
public $final = "Then, surprisingly, it worked the final time.";
|
||||
public $final = 'Then, surprisingly, it worked the final time.';
|
||||
}
|
||||
|
||||
class SectionObject
|
||||
|
||||
+4
-4
@@ -2,15 +2,15 @@
|
||||
|
||||
class Sections
|
||||
{
|
||||
public $start = "It worked the first time.";
|
||||
public $start = 'It worked the first time.';
|
||||
|
||||
public function middle()
|
||||
{
|
||||
return array(
|
||||
array('item' => "And it worked the second time."),
|
||||
array('item' => "As well as the third."),
|
||||
array('item' => 'And it worked the second time.'),
|
||||
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' => 'Piston Honda'),
|
||||
array('name' => 'Mr. Sandman'),
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
'name' => 'Mike Tyson',
|
||||
@@ -22,13 +22,13 @@ class SectionsNested
|
||||
array('name' => 'King Hippo'),
|
||||
array('name' => 'Great Tiger'),
|
||||
array('name' => 'Glass Joe'),
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
'name' => 'Don Flamenco',
|
||||
'enemies' => array(
|
||||
array('name' => 'Bald Bull'),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
class Simple
|
||||
{
|
||||
public $name = "Chris";
|
||||
public $name = 'Chris';
|
||||
public $value = 10000;
|
||||
|
||||
public function taxed_value()
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
|
||||
class Unescaped
|
||||
{
|
||||
public $title = "Bear > Shark";
|
||||
public $title = 'Bear > Shark';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user