Return false instead of null in hasPragma. Added documentation for pragma methods.

This commit is contained in:
Justin Hileman
2010-04-29 21:39:50 -04:00
parent 4d40070c69
commit f68335c845
+17 -1
View File
@@ -98,7 +98,6 @@ class Mustache {
} }
} }
/** /**
* Internal render function, used for recursive calls. * Internal render function, used for recursive calls.
* *
@@ -220,12 +219,29 @@ class Mustache {
return ''; return '';
} }
/**
* Check whether this Mustache has a specific pragma.
*
* @access protected
* @param string $pragma_name
* @return bool
*/
protected function hasPragma($pragma_name) { protected function hasPragma($pragma_name) {
if (array_key_exists($pragma_name, $this->pragmas) && $this->pragmas[$pragma_name]) { if (array_key_exists($pragma_name, $this->pragmas) && $this->pragmas[$pragma_name]) {
return true; return true;
} else {
return false;
} }
} }
/**
* Return pragma options, if any.
*
* @access protected
* @param string $pragma_name
* @return mixed
* @throws MustacheException Unknown pragma
*/
protected function getPragmaOptions($pragma_name) { protected function getPragmaOptions($pragma_name) {
if (!$this->hasPragma()) { if (!$this->hasPragma()) {
throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA); throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA);