concatenation with spaces around
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -341,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));
|
||||
@@ -552,7 +552,7 @@ class Mustache_Compiler
|
||||
*/
|
||||
private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
|
||||
{
|
||||
$text = ($prependNewline ? "\n" : '').trim($text);
|
||||
$text = ($prependNewline ? "\n" : '') . trim($text);
|
||||
if ($prependNewline) {
|
||||
$bonus++;
|
||||
}
|
||||
@@ -560,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)';
|
||||
|
||||
@@ -252,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)));
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -76,7 +76,7 @@ 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;',
|
||||
)
|
||||
),
|
||||
@@ -96,7 +96,7 @@ 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;',
|
||||
)
|
||||
),
|
||||
@@ -123,7 +123,7 @@ 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;',
|
||||
|
||||
@@ -237,7 +237,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
||||
|
||||
public static function wrapWithUnderscores($text)
|
||||
{
|
||||
return '__'.$text.'__';
|
||||
return '__' . $text . '__';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ 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);
|
||||
@@ -55,7 +55,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullpath = $path.'/'.$file;
|
||||
$fullpath = $path . '/' . $file;
|
||||
if (is_dir($fullpath)) {
|
||||
$examples[$file] = $this->loadExample($fullpath);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ 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') {
|
||||
@@ -128,7 +128,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullpath = $path.'/'.$file;
|
||||
$fullpath = $path . '/' . $file;
|
||||
$info = pathinfo($fullpath);
|
||||
|
||||
if ($info['extension'] === 'mustache') {
|
||||
|
||||
@@ -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"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullpath = $path.$file;
|
||||
$fullpath = $path . $file;
|
||||
if (is_dir($fullpath)) {
|
||||
self::rmdir($fullpath);
|
||||
} else {
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user