bobthecow/mustache.php — pull request #76 by conormcd (2012-01-21 12:42:39+00:00)
Title: Allow __call handle requests for view methods.

In the case where `method_exists($view, $tag_name)` fails *and* when `isset($view->$tag_name)` fails, this patch alters Mustache to attempt to call the method anyway. This allows the view to use `__call` to handle the method invocation.

Example:

```
class MyModel {
public function baz() {
return "baz";
}
}
```

```php
class MyView {
public $foo = "foo";

public function bar() {
return "bar";
}
}
```

```php
class View {
protected $_model;

public function __construct($model) {
$this->_model = $model;
}

public function __call($name, $args) {
return call_user_func_array(array($this->_model, $name), $args);
}
}
```

In this scenario, if we pass an instance of `MyView` to Mustache, then `foo`, `bar` and `baz` are all available.