ts3phpframework
Loading...
Searching...
No Matches
MockServerQuery.php
Go to the documentation of this file.
1<?php
2
3namespace PlanetTeamSpeak\TeamSpeak3Framework\Adapter;
4
5use PlanetTeamSpeak\TeamSpeak3Framework\Exception\AdapterException;
6use PlanetTeamSpeak\TeamSpeak3Framework\Helper\Profiler;
7use PlanetTeamSpeak\TeamSpeak3Framework\Helper\Signal;
8use PlanetTeamSpeak\TeamSpeak3Framework\TeamSpeak3;
9use PlanetTeamSpeak\TeamSpeak3Framework\Transport\MockTCP;
10
12{
20 protected function syn(): void
21 {
22 $this->initTransport($this->options, MockTCP::class);
23 $this->transport->setAdapter($this);
24
25 Profiler::init(spl_object_hash($this));
26
27 $rdy = $this->getTransport()->readLine();
28
29 if (!$rdy->startsWith(TeamSpeak3::TS3_PROTO_IDENT) && !$rdy->startsWith(TeamSpeak3::TEA_PROTO_IDENT) && !(defined("CUSTOM_PROTO_IDENT") && $rdy->startsWith(CUSTOM_PROTO_IDENT))) {
30 throw new AdapterException("invalid reply from the server (" . $rdy . ")");
31 }
32
33 Signal::getInstance()->emit("serverqueryConnected", $this);
34 }
35}
initTransport(array $options, string $transport=TCP::class)
Definition Adapter.php:111
Enhanced exception class for PlanetTeamSpeak\TeamSpeak3Framework\Adapter\Adapter objects.