Rename Mustache_Mustache to Mustache_Engine.

Because the former was just too absurd to keep typing.
This commit is contained in:
Justin Hileman
2012-05-01 21:30:22 -07:00
parent 1ffd7c1a8f
commit be5cfb3e9e
14 changed files with 37 additions and 37 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ A quick example:
```php ```php
<?php <?php
$m = new Mustache_Mustache; $m = new Mustache_Engine;
echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!" echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
``` ```
@@ -49,7 +49,7 @@ And render it:
```php ```php
<?php <?php
$m = new Mustache_Mustache; $m = new Mustache_Engine;
$chris = new Chris; $chris = new Chris;
echo $m->render($template, $chris); echo $m->render($template, $chris);
``` ```
@@ -21,7 +21,7 @@
* *
* @author Justin Hileman {@link http://justinhileman.com} * @author Justin Hileman {@link http://justinhileman.com}
*/ */
class Mustache_Mustache { class Mustache_Engine {
const VERSION = '2.0.0-dev'; const VERSION = '2.0.0-dev';
const SPEC_VERSION = '1.1.2'; const SPEC_VERSION = '1.1.2';
@@ -120,7 +120,7 @@ class Mustache_Mustache {
* *
* Equivalent to calling `$mustache->loadTemplate($template)->render($data);` * Equivalent to calling `$mustache->loadTemplate($template)->render($data);`
* *
* @see Mustache_Mustache::loadTemplate * @see Mustache_Engine::loadTemplate
* @see Mustache_Template::render * @see Mustache_Template::render
* *
* @param string $template * @param string $template
@@ -242,7 +242,7 @@ class Mustache_Mustache {
/** /**
* Get the current set of Mustache helpers. * Get the current set of Mustache helpers.
* *
* @see Mustache_Mustache::setHelpers * @see Mustache_Engine::setHelpers
* *
* @return Mustache_HelperCollection * @return Mustache_HelperCollection
*/ */
@@ -257,7 +257,7 @@ class Mustache_Mustache {
/** /**
* Add a new Mustache helper. * Add a new Mustache helper.
* *
* @see Mustache_Mustache::setHelpers * @see Mustache_Engine::setHelpers
* *
* @param string $name * @param string $name
* @param mixed $helper * @param mixed $helper
@@ -269,7 +269,7 @@ class Mustache_Mustache {
/** /**
* Get a Mustache helper by name. * Get a Mustache helper by name.
* *
* @see Mustache_Mustache::setHelpers * @see Mustache_Engine::setHelpers
* *
* @param string $name * @param string $name
* *
@@ -282,7 +282,7 @@ class Mustache_Mustache {
/** /**
* Check whether this Mustache instance has a helper. * Check whether this Mustache instance has a helper.
* *
* @see Mustache_Mustache::setHelpers * @see Mustache_Engine::setHelpers
* *
* @param string $name * @param string $name
* *
@@ -295,7 +295,7 @@ class Mustache_Mustache {
/** /**
* Remove a helper by name. * Remove a helper by name.
* *
* @see Mustache_Mustache::setHelpers * @see Mustache_Engine::setHelpers
* *
* @param string $name * @param string $name
*/ */
@@ -443,9 +443,9 @@ class Mustache_Mustache {
/** /**
* Instantiate and return a Mustache Template instance by source. * Instantiate and return a Mustache Template instance by source.
* *
* @see Mustache_Mustache::loadTemplate * @see Mustache_Engine::loadTemplate
* @see Mustache_Mustache::loadPartial * @see Mustache_Engine::loadPartial
* @see Mustache_Mustache::loadLambda * @see Mustache_Engine::loadLambda
* *
* @param string $source * @param string $source
* *
+1 -1
View File
@@ -21,7 +21,7 @@
* *
* $tpl = $loader->load('foo'); // '{{ bar }}' * $tpl = $loader->load('foo'); // '{{ bar }}'
* *
* The ArrayLoader is used internally as a partials loader by Mustache_Mustache instance when an array of partials * The ArrayLoader is used internally as a partials loader by Mustache_Engine instance when an array of partials
* is set. It can also be used as a quick-and-dirty Template loader. * is set. It can also be used as a quick-and-dirty Template loader.
* *
* @implements Loader * @implements Loader
+4 -4
View File
@@ -17,23 +17,23 @@
abstract class Mustache_Template { abstract class Mustache_Template {
/** /**
* @var Mustache_Mustache * @var Mustache_Engine
*/ */
protected $mustache; protected $mustache;
/** /**
* Mustache Template constructor. * Mustache Template constructor.
* *
* @param Mustache_Mustache $mustache * @param Mustache_Engine $mustache
*/ */
public function __construct(Mustache_Mustache $mustache) { public function __construct(Mustache_Engine $mustache) {
$this->mustache = $mustache; $this->mustache = $mustache;
} }
/** /**
* 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_Mustache; * $m = new Mustache_Engine;
* $tpl = $m->loadTemplate('Hello, {{ name }}!'); * $tpl = $m->loadTemplate('Hello, {{ name }}!');
* echo $tpl(array('name' => 'World')); // "Hello, World!" * echo $tpl(array('name' => 'World')); // "Hello, World!"
* *
@@ -12,7 +12,7 @@
/** /**
* @group unit * @group unit
*/ */
class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase { class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase {
private static $tempDir; private static $tempDir;
@@ -26,7 +26,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
public function testConstructor() { public function testConstructor() {
$loader = new Mustache_Loader_StringLoader; $loader = new Mustache_Loader_StringLoader;
$partialsLoader = new Mustache_Loader_ArrayLoader; $partialsLoader = new Mustache_Loader_ArrayLoader;
$mustache = new Mustache_Mustache(array( $mustache = new Mustache_Engine(array(
'template_class_prefix' => '__whot__', 'template_class_prefix' => '__whot__',
'cache' => self::$tempDir, 'cache' => self::$tempDir,
'loader' => $loader, 'loader' => $loader,
@@ -83,7 +83,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
$tokenizer = new Mustache_Tokenizer; $tokenizer = new Mustache_Tokenizer;
$parser = new Mustache_Parser; $parser = new Mustache_Parser;
$compiler = new Mustache_Compiler; $compiler = new Mustache_Compiler;
$mustache = new Mustache_Mustache; $mustache = new Mustache_Engine;
$this->assertNotSame($loader, $mustache->getLoader()); $this->assertNotSame($loader, $mustache->getLoader());
$mustache->setLoader($loader); $mustache->setLoader($loader);
@@ -110,7 +110,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @group functional * @group functional
*/ */
public function testCache() { public function testCache() {
$mustache = new Mustache_Mustache(array( $mustache = new Mustache_Engine(array(
'template_class_prefix' => '__whot__', 'template_class_prefix' => '__whot__',
'cache' => self::$tempDir, 'cache' => self::$tempDir,
)); ));
@@ -129,7 +129,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @dataProvider getBadEscapers * @dataProvider getBadEscapers
*/ */
public function testNonCallableEscapeThrowsException($escape) { public function testNonCallableEscapeThrowsException($escape) {
new Mustache_Mustache(array('escape' => $escape)); new Mustache_Engine(array('escape' => $escape));
} }
public function getBadEscapers() { public function getBadEscapers() {
@@ -143,7 +143,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @expectedException RuntimeException * @expectedException RuntimeException
*/ */
public function testImmutablePartialsLoadersThrowException() { public function testImmutablePartialsLoadersThrowException() {
$mustache = new Mustache_Mustache(array( $mustache = new Mustache_Engine(array(
'partials_loader' => new Mustache_Loader_StringLoader, 'partials_loader' => new Mustache_Loader_StringLoader,
)); ));
@@ -151,7 +151,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
} }
public function testMissingPartialsTreatedAsEmptyString() { public function testMissingPartialsTreatedAsEmptyString() {
$mustache = new Mustache_Mustache(array( $mustache = new Mustache_Engine(array(
'partials_loader' => new Mustache_Loader_ArrayLoader(array( 'partials_loader' => new Mustache_Loader_ArrayLoader(array(
'foo' => 'FOO', 'foo' => 'FOO',
'baz' => 'BAZ', 'baz' => 'BAZ',
@@ -164,7 +164,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
public function testHelpers() { public function testHelpers() {
$foo = array($this, 'getFoo'); $foo = array($this, 'getFoo');
$bar = 'BAR'; $bar = 'BAR';
$mustache = new Mustache_Mustache(array('helpers' => array( $mustache = new Mustache_Engine(array('helpers' => array(
'foo' => $foo, 'foo' => $foo,
'bar' => $bar, 'bar' => $bar,
))); )));
@@ -204,7 +204,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @expectedException InvalidArgumentException * @expectedException InvalidArgumentException
*/ */
public function testSetHelpersThrowsExceptions() { public function testSetHelpersThrowsExceptions() {
$mustache = new Mustache_Mustache; $mustache = new Mustache_Engine;
$mustache->setHelpers('monkeymonkeymonkey'); $mustache->setHelpers('monkeymonkeymonkey');
} }
@@ -229,7 +229,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
} }
} }
class MustacheStub extends Mustache_Mustache { class MustacheStub extends Mustache_Engine {
public $source; public $source;
public $template; public $template;
public function loadTemplate($source) { public function loadTemplate($source) {
@@ -18,7 +18,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
private $mustache; private $mustache;
public function setUp() { public function setUp() {
$this->mustache = new Mustache_Mustache; $this->mustache = new Mustache_Engine;
} }
public function testAnonymousFunctionSectionCallback() { public function testAnonymousFunctionSectionCallback() {
@@ -20,7 +20,7 @@ class Mustache_Test_FiveThree_Functional_MustacheSpecTest extends PHPUnit_Framew
private static $mustache; private static $mustache;
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
self::$mustache = new Mustache_Mustache; self::$mustache = new Mustache_Engine;
} }
/** /**
+1 -1
View File
@@ -16,7 +16,7 @@
class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase { class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase {
public function testCallEatsContext() { public function testCallEatsContext() {
$m = new Mustache_Mustache; $m = new Mustache_Engine;
$tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}'); $tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}');
$foo = new Mustache_Test_Functional_ClassWithCall(); $foo = new Mustache_Test_Functional_ClassWithCall();
@@ -26,7 +26,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase {
* @param string $expected * @param string $expected
*/ */
public function testExamples($context, $source, $partials, $expected) { public function testExamples($context, $source, $partials, $expected) {
$mustache = new Mustache_Mustache(array( $mustache = new Mustache_Engine(array(
'partials' => $partials 'partials' => $partials
)); ));
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context)); $this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
@@ -18,7 +18,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends PHPUnit_Framework
private $mustache; private $mustache;
public function setUp() { public function setUp() {
$this->mustache = new Mustache_Mustache; $this->mustache = new Mustache_Engine;
} }
public function testRuntimeSectionCallback() { public function testRuntimeSectionCallback() {
@@ -18,7 +18,7 @@ class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_T
private $mustache; private $mustache;
public function setUp() { public function setUp() {
$this->mustache = new Mustache_Mustache; $this->mustache = new Mustache_Engine;
} }
// interpolation // interpolation
@@ -20,7 +20,7 @@ class Mustache_Test_Functional_MustacheSpecTest extends PHPUnit_Framework_TestCa
private static $mustache; private static $mustache;
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
self::$mustache = new Mustache_Mustache; self::$mustache = new Mustache_Engine;
} }
/** /**
@@ -17,7 +17,7 @@ class Mustache_Test_Functional_ObjectSectionTest extends PHPUnit_Framework_TestC
private $mustache; private $mustache;
public function setUp() { public function setUp() {
$this->mustache = new Mustache_Mustache; $this->mustache = new Mustache_Engine;
} }
public function testBasicObject() { public function testBasicObject() {
+2 -2
View File
@@ -14,14 +14,14 @@
*/ */
class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase { class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase {
public function testConstructor() { public function testConstructor() {
$mustache = new Mustache_Mustache; $mustache = new Mustache_Engine;
$template = new Mustache_Test_TemplateStub($mustache); $template = new Mustache_Test_TemplateStub($mustache);
$this->assertSame($mustache, $template->getMustache()); $this->assertSame($mustache, $template->getMustache());
} }
public function testRendering() { public function testRendering() {
$rendered = '<< wheee >>'; $rendered = '<< wheee >>';
$mustache = new Mustache_Mustache; $mustache = new Mustache_Engine;
$template = new Mustache_Test_TemplateStub($mustache); $template = new Mustache_Test_TemplateStub($mustache);
$template->rendered = $rendered; $template->rendered = $rendered;
$context = new Mustache_Context; $context = new Mustache_Context;