本文整理汇总了PHP中TeamSpeak3_Helper_String::section方法的典型用法代码示例。如果您正苦于以下问题:PHP TeamSpeak3_Helper_String::section方法的具体用法?PHP TeamSpeak3_Helper_String::section怎么用?PHP TeamSpeak3_Helper_String::section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TeamSpeak3_Helper_String
的用法示例。
在下文中一共展示了TeamSpeak3_Helper_String::section方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchError
/**
* Parses a ServerQuery error and returns a TeamSpeak3_Adapter_ServerQuery_Exception object.
*
* @param string $err
* @throws TeamSpeak3_Adapter_ServerQuery_Exception
* @return void
*/
private function fetchError($err)
{
$cells = $err->section(TeamSpeak3::SEPERATOR_CELL, 1, 3);
foreach ($cells->split(TeamSpeak3::SEPERATOR_CELL) as $pair) {
list($ident, $value) = $pair->split(TeamSpeak3::SEPERATOR_PAIR);
$this->err[$ident->toString()] = $value->is_numeric() ? $value->toInt() : $value->unescape();
}
if ($this->getErrorProperty("id", 0x0) != 0x0) {
if ($permid = $this->getErrorProperty("failed_permid")) {
$suffix = " (failed on " . $this->cmd->section(TeamSpeak3::SEPERATOR_CELL) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
} elseif ($details = $this->getErrorProperty("extra_msg")) {
$suffix = " (" . $details . ")";
} else {
$suffix = "";
}
throw new TeamSpeak3_Adapter_ServerQuery_Exception($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"));
}
}
示例2: fetchError
/**
* Parses a ServerQuery error and throws a TeamSpeak3_Adapter_ServerQuery_Exception object if
* there's an error.
*
* @param string $err
* @throws TeamSpeak3_Adapter_ServerQuery_Exception
* @return void
*/
protected function fetchError($err)
{
$cells = $err->section(TeamSpeak3::SEPARATOR_CELL, 1, 3);
foreach ($cells->split(TeamSpeak3::SEPARATOR_CELL) as $pair) {
list($ident, $value) = $pair->split(TeamSpeak3::SEPARATOR_PAIR);
$this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape();
}
TeamSpeak3_Helper_Signal::getInstance()->emit("notifyError", $this);
if ($this->getErrorProperty("id", 0x0) != 0x0 && $this->exp) {
if ($permid = $this->getErrorProperty("failed_permid")) {
if ($permsid = key($this->con->request("permget permid=" . $permid, FALSE)->toAssocArray("permsid"))) {
$suffix = " (failed on " . $permsid . ")";
} else {
$suffix = " (failed on " . $this->cmd->section(TeamSpeak3::SEPARATOR_CELL) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
}
} elseif ($details = $this->getErrorProperty("extra_msg")) {
$suffix = " (" . trim($details) . ")";
} else {
$suffix = "";
}
throw new TeamSpeak3_Adapter_ServerQuery_Exception($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"));
}
}
示例3: versionShort
/**
* Returns a client-like short-formatted version of the TeamSpeak 3 version string.
*
* @param string $version
* @return string
*/
public static function versionShort($version)
{
if (!$version instanceof TeamSpeak3_Helper_String) {
$version = new TeamSpeak3_Helper_String($version);
}
return $version->section(" ", 0);
}
示例4: version
/**
* Returns a client-like formatted version of the TeamSpeak 3 version string.
*
* @param string $version
* @param string $format
* @return string
*/
public static function version($version, $format = "Y-m-d h:i:s")
{
if (!$version instanceof TeamSpeak3_Helper_String) {
$version = new TeamSpeak3_Helper_String($version);
}
$buildno = $version->section("[", 1)->filterDigits()->toInt();
return $buildno <= 15001 ? $version : $version->section("[")->append("(" . date($format, $buildno) . ")");
}