diff --git a/bin/build_bootstrap.php b/bin/build_bootstrap.php index f9fa2af..7863efc 100755 --- a/bin/build_bootstrap.php +++ b/bin/build_bootstrap.php @@ -20,13 +20,13 @@ * containing all Mustache library classes. This file can then be included in * your project, rather than requiring the Mustache Autoloader. */ -$baseDir = realpath(dirname(__FILE__).'/..'); +$baseDir = realpath(dirname(__FILE__) . '/..'); -require $baseDir.'/src/Mustache/Autoloader.php'; +require $baseDir . '/src/Mustache/Autoloader.php'; Mustache_Autoloader::register(); // delete the old file -$file = $baseDir.'/mustache.php'; +$file = $baseDir . '/mustache.php'; if (file_exists($file)) { unlink($file); } @@ -77,7 +77,7 @@ SymfonyClassCollectionLoader::load(array( */ class SymfonyClassCollectionLoader { - static private $loaded; + private static $loaded; const HEADER = <<\s*$/'), '', file_get_contents($r->getFileName())); } - $cache = $cacheDir.'/'.$name.$extension; + $cache = $cacheDir . '/' . $name . $extension; $header = sprintf(self::HEADER, strftime('%Y')); - self::writeCacheFile($cache, $header . substr(self::stripComments(' 1) { +if (count($argv) > 1) { // get the name of the example $example_name = $argv[1]; diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index b395336..95aa5d6 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -213,7 +213,7 @@ class Mustache_Engine */ public function getEntityFlags() { - return $this->entityFlags; + return $this->entityFlags; } /** diff --git a/src/Mustache/HelperCollection.php b/src/Mustache/HelperCollection.php index bbeb277..c7c7950 100644 --- a/src/Mustache/HelperCollection.php +++ b/src/Mustache/HelperCollection.php @@ -27,14 +27,16 @@ class Mustache_HelperCollection */ public function __construct($helpers = null) { - if ($helpers !== null) { - if (!is_array($helpers) && !$helpers instanceof Traversable) { - throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); - } + if ($helpers === null) { + return; + } - foreach ($helpers as $name => $helper) { - $this->add($name, $helper); - } + if (!is_array($helpers) && !$helpers instanceof Traversable) { + throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); + } + + foreach ($helpers as $name => $helper) { + $this->add($name, $helper); } } diff --git a/src/Mustache/Tokenizer.php b/src/Mustache/Tokenizer.php index 68ec5c1..bf1e5d1 100644 --- a/src/Mustache/Tokenizer.php +++ b/src/Mustache/Tokenizer.php @@ -116,7 +116,7 @@ class Mustache_Tokenizer } else { $char = $text[$i]; $this->buffer .= $char; - if ($char == "\n") { + if ($char === "\n") { $this->flushBuffer(); $this->line++; } @@ -157,14 +157,14 @@ 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 ); $this->buffer = ''; $i += $this->ctagLen - 1; $this->state = self::IN_TEXT; - if ($this->tagType == self::T_UNESCAPED) { - if ($this->ctag == '}}') { + if ($this->tagType === self::T_UNESCAPED) { + if ($this->ctag === '}}') { $i++; } else { // Clean up `{{{ tripleStache }}}` style tokens. diff --git a/test/bootstrap.php b/test/bootstrap.php index 03a119f..99b6fcf 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -9,8 +9,8 @@ * file that was distributed with this source code. */ -require dirname(__FILE__).'/../src/Mustache/Autoloader.php'; +require dirname(__FILE__) . '/../src/Mustache/Autoloader.php'; Mustache_Autoloader::register(); -Mustache_Autoloader::register(dirname(__FILE__).'/../test'); +Mustache_Autoloader::register(dirname(__FILE__) . '/../test'); -require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php'; +require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php';