Livestatus\Query: split string cast implementation

This way we can use an exception-throwing variant internally while not
breaking __toString
This commit is contained in:
Thomas Gelf 2014-11-16 15:13:07 +01:00
parent 38fec33849
commit 0916f57ce8
1 changed files with 16 additions and 0 deletions

View File

@ -38,8 +38,24 @@ class Query extends SimpleQuery
$this->count = true; $this->count = true;
return $this; return $this;
} }
*/
/**
* Automagic string casting
*
* @return string
*/ */
public function __toString() public function __toString()
{
return $this->toString();
}
/**
* Render query string
*
* @return string
*/
public function toString()
{ {
if ($this->table === null) { if ($this->table === null) {
throw new IcingaException('Table is required'); throw new IcingaException('Table is required');