Exemplo n.º 1
0
 protected function getConstants()
 {
     $collect = [];
     $data = $this->reflection->getConstants();
     foreach ($data as $key => $value) {
         $collect[] = Constant::factory(compact('key', 'value'));
     }
     return $collect;
 }
Exemplo n.º 2
0
 /**
  * Returns the first ServerNode object matching the given TSDNS hostname. Like the
  * TeamSpeak 3 Client, this method will start looking for a TSDNS server on the second-level
  * domain including a fallback to the third-level domain of the specified $tsdns parameter.
  *
  * @param  string $tsdns
  *
  * @throws ServerQueryException
  * @return ServerNode
  */
 public function serverGetByTSDNS($tsdns)
 {
     $parts = Uri::getFQDNParts($tsdns);
     $query = String::factory(array_shift($parts));
     while ($part = array_shift($parts)) {
         $query->prepend($part);
         try {
             $port = Constant::factory("tsdns://" . $query . "/?timeout=3")->resolve($tsdns)->section(":", 1);
             return $this->serverGetByPort($port == "" ? 9987 : $port);
         } catch (TransportException $e) {
             /* skip "Connection timed out" and "Connection refused" */
             if ($e->getCode() != 10060 && $e->getCode() != 10061) {
                 throw $e;
             }
         }
     }
     throw new ServerQueryException("invalid serverID", 0x400);
 }