diff --git a/src/Mustache/Autoloader.php b/src/Mustache/Autoloader.php index 8c8e906..d9b2935 100644 --- a/src/Mustache/Autoloader.php +++ b/src/Mustache/Autoloader.php @@ -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 diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 4b3cd8e..c872df4 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -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)'; diff --git a/src/Mustache/Tokenizer.php b/src/Mustache/Tokenizer.php index be9ca14..467ec68 100644 --- a/src/Mustache/Tokenizer.php +++ b/src/Mustache/Tokenizer.php @@ -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))); diff --git a/test/Mustache/Test/AutoloaderTest.php b/test/Mustache/Test/AutoloaderTest.php index 32fb0dc..01e6d28 100644 --- a/test/Mustache/Test/AutoloaderTest.php +++ b/test/Mustache/Test/AutoloaderTest.php @@ -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')); diff --git a/test/Mustache/Test/CompilerTest.php b/test/Mustache/Test/CompilerTest.php index fe7cdde..b6bcbdc 100644 --- a/test/Mustache/Test/CompilerTest.php +++ b/test/Mustache/Test/CompilerTest.php @@ -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;', diff --git a/test/Mustache/Test/EngineTest.php b/test/Mustache/Test/EngineTest.php index f61f876..eb5c0ff 100644 --- a/test/Mustache/Test/EngineTest.php +++ b/test/Mustache/Test/EngineTest.php @@ -237,7 +237,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase public static function wrapWithUnderscores($text) { - return '__'.$text.'__'; + return '__' . $text . '__'; } /** diff --git a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php index 88094fb..9a32ba0 100644 --- a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php @@ -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"'); } } diff --git a/test/Mustache/Test/Functional/ExamplesTest.php b/test/Mustache/Test/Functional/ExamplesTest.php index 9feccaf..68754a6 100644 --- a/test/Mustache/Test/Functional/ExamplesTest.php +++ b/test/Mustache/Test/Functional/ExamplesTest.php @@ -46,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); } @@ -81,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)) { @@ -124,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') { diff --git a/test/Mustache/Test/Functional/MustacheSpecTest.php b/test/Mustache/Test/Functional/MustacheSpecTest.php index 96fcf40..25c73f2 100644 --- a/test/Mustache/Test/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/Functional/MustacheSpecTest.php @@ -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"'); } } diff --git a/test/Mustache/Test/FunctionalTestCase.php b/test/Mustache/Test/FunctionalTestCase.php index 4d243e0..34647fc 100644 --- a/test/Mustache/Test/FunctionalTestCase.php +++ b/test/Mustache/Test/FunctionalTestCase.php @@ -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 { diff --git a/test/Mustache/Test/Loader/FilesystemLoaderTest.php b/test/Mustache/Test/Loader/FilesystemLoaderTest.php index 17c15fa..d569961 100644 --- a/test/Mustache/Test/Loader/FilesystemLoaderTest.php +++ b/test/Mustache/Test/Loader/FilesystemLoaderTest.php @@ -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');