Livestatus\Query: parse an array structure

This commit is contained in:
Thomas Gelf 2014-11-16 15:22:54 +01:00
parent 1b8449009c
commit 23546a4224
1 changed files with 22 additions and 0 deletions

View File

@ -20,6 +20,28 @@ class Query extends SimpleQuery
return $this->columns;
}
/**
* Parse the given encoded array
*
* @param string $str the encoded array string
*
* @return array
*/
public function parseArray($str)
{
if (empty($str)) {
return array();
}
$result = array();
$entries = preg_split('/,/', $str);
foreach ($entries as $e) {
$result[] = preg_split('/;/', $e);
}
return $result;
}
public function getColumnAliases()
{
$aliases = array();