3namespace PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery;
5use PlanetTeamSpeak\TeamSpeak3Framework\Exception\AdapterException;
6use PlanetTeamSpeak\TeamSpeak3Framework\Exception\ServerQueryException;
7use PlanetTeamSpeak\TeamSpeak3Framework\Helper\Signal;
8use PlanetTeamSpeak\TeamSpeak3Framework\Helper\StringHelper;
9use PlanetTeamSpeak\TeamSpeak3Framework\Node\Host;
10use PlanetTeamSpeak\TeamSpeak3Framework\TeamSpeak3;
60 protected bool $exp =
true;
99 if (!count($this->rpl)) {
105 if (!func_num_args()) {
106 for ($i = 0; $i < count($list); $i++) {
107 $list[$i]->unescape();
123 foreach ($this->
toLines(0) as $cells) {
126 if (!func_num_args()) {
127 for ($i = 0; $i < count($pairs); $i++) {
128 $pairs[$i]->unescape();
148 for ($i = 0; $i < count($table); $i++) {
149 foreach ($table[$i] as $pair) {
155 $array[$i][$pair->toString()] =
null;
159 $array[$i][$ident->toString()] = $value->isInt() ? $value->toInt() : (!func_num_args() ? $value->unescape() : $value);
177 $nodes = (func_num_args() > 1) ? $this->
toArray(1) : $this->
toArray();
180 foreach ($nodes as $node) {
181 if (isset($node[$ident])) {
182 $array[(is_object($node[$ident])) ? $node[$ident]->
toString() : $node[$ident]] = $node;
184 throw new ServerQueryException(
"invalid parameter. ident '$ident' does not exist in node '".json_encode($node).
"'", 0x602);
200 if (count($array) == 1) {
201 return array_shift($array);
214 $array = (func_num_args() > 1) ? $this->
toArray(1) : $this->
toArray();
216 for ($i = 0; $i < count($array); $i++) {
217 $array[$i] = (object)$array[$i];
252 return (array_key_exists($ident, $this->err)) ? $this->err[$ident] : $default;
271 $this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape();
274 Signal::getInstance()->emit(
"notifyError", $this);
278 if ($permsid = key($this->con->request(
"permget permid=" . $permid,
false)->toAssocArray(
"permsid"))) {
279 $suffix =
" (failed on " . $permsid .
")";
281 $suffix =
" (failed on " . $this->cmd->section(
TeamSpeak3::SEPARATOR_CELL) .
" " . $permid .
"/0x" . strtoupper(dechex($permid)) .
")";
284 $suffix =
" (" . trim($details) .
")";
302 foreach (
$rpl as $key => $val) {
306 $this->evt[] =
new Event($val, $this->con);
Provides methods to analyze and format a ServerQuery event.
Provides methods to analyze and format a ServerQuery reply.
getErrorProperty(string $ident, mixed $default=null)
__construct(array $rpl, string $cmd="", Host $con=null, bool $exp=true)
fetchError(StringHelper $err)
Enhanced exception class for PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery objects.
Helper class for string handling.
Class describing a TeamSpeak 3 server instance and all it's parameters.
const SEPARATOR_CELL
protocol cell separator
const SEPARATOR_PAIR
protocol pair separator
const SEPARATOR_LIST
protocol list separator