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
$m = new Mustache_Mustache;
$m = new Mustache_Engine;
echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
```
@@ -49,7 +49,7 @@ And render it:
```php
<?php
$m = new Mustache_Mustache;
$m = new Mustache_Engine;
$chris = new Chris;
echo $m->render($template, $chris);
```
@@ -21,7 +21,7 @@
*
* @author Justin Hileman {@link http://justinhileman.com}
*/
class Mustache_Mustache {
class Mustache_Engine {
const VERSION = '2.0.0-dev';
const SPEC_VERSION = '1.1.2';
@@ -120,7 +120,7 @@ class Mustache_Mustache {
*
* Equivalent to calling `$mustache->loadTemplate($template)->render($data);`
*
* @see Mustache_Mustache::loadTemplate
* @see Mustache_Engine::loadTemplate
* @see Mustache_Template::render
*
* @param string $template
@@ -242,7 +242,7 @@ class Mustache_Mustache {
/**
* Get the current set of Mustache helpers.
*
* @see Mustache_Mustache::setHelpers
* @see Mustache_Engine::setHelpers
*
* @return Mustache_HelperCollection
*/
@@ -257,7 +257,7 @@ class Mustache_Mustache {
/**
* Add a new Mustache helper.
*
* @see Mustache_Mustache::setHelpers
* @see Mustache_Engine::setHelpers
*
* @param string $name
* @param mixed $helper
@@ -269,7 +269,7 @@ class Mustache_Mustache {
/**
* Get a Mustache helper by name.
*
* @see Mustache_Mustache::setHelpers
* @see Mustache_Engine::setHelpers
*
* @param string $name
*
@@ -282,7 +282,7 @@ class Mustache_Mustache {
/**
* Check whether this Mustache instance has a helper.
*
* @see Mustache_Mustache::setHelpers
* @see Mustache_Engine::setHelpers
*
* @param string $name
*
@@ -295,7 +295,7 @@ class Mustache_Mustache {
/**
* Remove a helper by name.
*
* @see Mustache_Mustache::setHelpers
* @see Mustache_Engine::setHelpers
*
* @param string $name
*/
@@ -443,9 +443,9 @@ class Mustache_Mustache {
/**
* Instantiate and return a Mustache Template instance by source.
*
* @see Mustache_Mustache::loadTemplate
* @see Mustache_Mustache::loadPartial
* @see Mustache_Mustache::loadLambda
* @see Mustache_Engine::loadTemplate
* @see Mustache_Engine::loadPartial
* @see Mustache_Engine::loadLambda
*
* @param string $source
*
+1 -1
View File
@@ -21,7 +21,7 @@
*
* $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.
*
* @implements Loader
+4 -4
View File
@@ -17,23 +17,23 @@
abstract class Mustache_Template {
/**
* @var Mustache_Mustache
* @var Mustache_Engine
*/
protected $mustache;
/**
* 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;
}
/**
* 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 }}!');
* echo $tpl(array('name' => 'World')); // "Hello, World!"
*
@@ -12,7 +12,7 @@
/**
* @group unit
*/
class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase {
private static $tempDir;
@@ -26,7 +26,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
public function testConstructor() {
$loader = new Mustache_Loader_StringLoader;
$partialsLoader = new Mustache_Loader_ArrayLoader;
$mustache = new Mustache_Mustache(array(
$mustache = new Mustache_Engine(array(
'template_class_prefix' => '__whot__',
'cache' => self::$tempDir,
'loader' => $loader,
@@ -83,7 +83,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
$tokenizer = new Mustache_Tokenizer;
$parser = new Mustache_Parser;
$compiler = new Mustache_Compiler;
$mustache = new Mustache_Mustache;
$mustache = new Mustache_Engine;
$this->assertNotSame($loader, $mustache->getLoader());
$mustache->setLoader($loader);
@@ -110,7 +110,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @group functional
*/
public function testCache() {
$mustache = new Mustache_Mustache(array(
$mustache = new Mustache_Engine(array(
'template_class_prefix' => '__whot__',
'cache' => self::$tempDir,
));
@@ -129,7 +129,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @dataProvider getBadEscapers
*/
public function testNonCallableEscapeThrowsException($escape) {
new Mustache_Mustache(array('escape' => $escape));
new Mustache_Engine(array('escape' => $escape));
}
public function getBadEscapers() {
@@ -143,7 +143,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @expectedException RuntimeException
*/
public function testImmutablePartialsLoadersThrowException() {
$mustache = new Mustache_Mustache(array(
$mustache = new Mustache_Engine(array(
'partials_loader' => new Mustache_Loader_StringLoader,
));
@@ -151,7 +151,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
}
public function testMissingPartialsTreatedAsEmptyString() {
$mustache = new Mustache_Mustache(array(
$mustache = new Mustache_Engine(array(
'partials_loader' => new Mustache_Loader_ArrayLoader(array(
'foo' => 'FOO',
'baz' => 'BAZ',
@@ -164,7 +164,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
public function testHelpers() {
$foo = array($this, 'getFoo');
$bar = 'BAR';
$mustache = new Mustache_Mustache(array('helpers' => array(
$mustache = new Mustache_Engine(array('helpers' => array(
'foo' => $foo,
'bar' => $bar,
)));
@@ -204,7 +204,7 @@ class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
* @expectedException InvalidArgumentException
*/
public function testSetHelpersThrowsExceptions() {
$mustache = new Mustache_Mustache;
$mustache = new Mustache_Engine;
$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 $template;
public function loadTemplate($source) {
@@ -18,7 +18,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
private $mustache;
public function setUp() {
$this->mustache = new Mustache_Mustache;
$this->mustache = new Mustache_Engine;
}
public function testAnonymousFunctionSectionCallback() {
@@ -20,7 +20,7 @@ class Mustache_Test_FiveThree_Functional_MustacheSpecTest extends PHPUnit_Framew
private static $mustache;
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 {
public function testCallEatsContext() {
$m = new Mustache_Mustache;
$m = new Mustache_Engine;
$tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}');
$foo = new Mustache_Test_Functional_ClassWithCall();
@@ -26,7 +26,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase {
* @param string $expected
*/
public function testExamples($context, $source, $partials, $expected) {
$mustache = new Mustache_Mustache(array(
$mustache = new Mustache_Engine(array(
'partials' => $partials
));
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
@@ -18,7 +18,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends PHPUnit_Framework
private $mustache;
public function setUp() {
$this->mustache = new Mustache_Mustache;
$this->mustache = new Mustache_Engine;
}
public function testRuntimeSectionCallback() {
@@ -18,7 +18,7 @@ class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_T
private $mustache;
public function setUp() {
$this->mustache = new Mustache_Mustache;
$this->mustache = new Mustache_Engine;
}
// interpolation
@@ -20,7 +20,7 @@ class Mustache_Test_Functional_MustacheSpecTest extends PHPUnit_Framework_TestCa
private static $mustache;
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;
public function setUp() {
$this->mustache = new Mustache_Mustache;
$this->mustache = new Mustache_Engine;
}
public function testBasicObject() {
+2 -2
View File
@@ -14,14 +14,14 @@
*/
class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase {
public function testConstructor() {
$mustache = new Mustache_Mustache;
$mustache = new Mustache_Engine;
$template = new Mustache_Test_TemplateStub($mustache);
$this->assertSame($mustache, $template->getMustache());
}
public function testRendering() {
$rendered = '<< wheee >>';
$mustache = new Mustache_Mustache;
$mustache = new Mustache_Engine;
$template = new Mustache_Test_TemplateStub($mustache);
$template->rendered = $rendered;
$context = new Mustache_Context;