本文整理汇总了PHP中RuntimeException::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP RuntimeException::__toString方法的具体用法?PHP RuntimeException::__toString怎么用?PHP RuntimeException::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RuntimeException
的用法示例。
在下文中一共展示了RuntimeException::__toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
/**
* Returns a string representation of the exception.
*
* @return string The exception as a string.
*/
public function __toString()
{
$result = parent::__toString();
if (null !== $this->getSocketErrorNumber()) {
$result .= "\nSocket error number:" . $this->getSocketErrorNumber();
}
if (null !== $this->getSocketErrorMessage()) {
$result .= "\nSocket error message:" . $this->getSocketErrorMessage();
}
return $result;
}
示例2: __toString
public function __toString()
{
if (!$this->getPrevious()) {
return parent::__toString();
}
// PHP strangely shows the innermost exception first before the outer
// exception message. It also has a default character limit for
// exception message strings such that the "next" exception (this one)
// might not even get shown, causing developers to attempt to catch
// the inner exception instead of the actual exception because they
// can't see the outer exception's __toString output.
return sprintf("exception '%s' with message '%s'\n\n%s", get_class($this), $this->getMessage(), parent::__toString());
}
示例3: __toString
public function __toString()
{
return 'Socket exception: ' . parent::__toString();
}
示例4: __toString
public function __toString()
{
return parent::__toString() . implode("\n", $this->errors);
}