Return false instead of null in hasPragma. Added documentation for pragma methods.
This commit is contained in:
+17
-1
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user