本文整理汇总了PHP中Exception::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::__construct方法的具体用法?PHP Exception::__construct怎么用?PHP Exception::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
/**
* Constructor.
*
* @param string $message
* @param string $code
* @param string $httpBody
* @param integer $httpCode
*
* @return void
*/
function __construct($message = null, $code = 0, $httpBody = null, $httpCode = 0)
{
$this->httpBody = $httpBody;
$this->httpCode = $httpCode;
$message = sprintf($this->message, $httpCode);
parent::__construct($message, $code);
}
示例2: __construct
/**
* Builds a new TailException object.
*
* @param string $filename the name of the file
* @param int $nblines the number of lines wanted
* @param int $hint an estimation of the median number of characters per line
* @param string $message the message of the exception
* @param int $code the error code associated to this exception
*/
public function __construct($filename, $nblines, $hint, $message, $code)
{
parent::__construct($message, $code);
$this->_filename = $filename;
$this->_nblines = $nblines;
$this->_hint = $hint;
}
示例3: switch
function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
{
switch ($fn) {
case 'EXECUTE':
$this->sql = $p1;
$this->params = $p2;
$s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}(\"{$p1}\")\n";
break;
case 'PCONNECT':
case 'CONNECT':
$user = $thisConnection->user;
$s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}({$p1}, '{$user}', '****', {$p2})\n";
break;
default:
$s = "{$dbms} error: [{$errno}: {$errmsg}] in {$fn}({$p1}, {$p2})\n";
break;
}
$this->dbms = $dbms;
if ($thisConnection) {
$this->host = $thisConnection->host;
$this->database = $thisConnection->database;
}
$this->fn = $fn;
$this->msg = $errmsg;
if (!is_numeric($errno)) {
$errno = -1;
}
parent::__construct($s, $errno);
}
示例4: __construct
public function __construct($message, $file, $line)
{
$message .= " in {$file} on line {$line}";
parent::__construct($message);
$this->file = $file;
$this->line = $line;
}
示例5: __construct
public function __construct($message = null, $code = null, Exception $previous = null)
{
$message = $message ?: 'Please make sure you either provide an Eloquent Model Class as the 3rd argument or use this inside an Eloquent Model';
$code = $code ?: 403;
// make sure everything is assigned properly
parent::__construct($message, $code, $previous);
}
示例6: __construct
/**
* Constructor.
*
* @param string $message Message default = ''.
* @param integer $code Code default = 404.
* @param mixed $debug Debug default = null.
*/
public function __construct($message = '', $code = 404, $debug = null)
{
if (empty($message)) {
$message = __('The requested page could not be found or is not currently accessible.');
}
parent::__construct($message, $code, $debug);
}
示例7: __construct
/**
* Make a new API Exception with the given result.
*
* @param Array $result the result from the API server
*/
public function __construct($result)
{
$this->result = $result;
$code = isset($result['error_code']) ? $result['error_code'] : 0;
$msg = isset($result['error']) ? $result['error']['message'] : $result['error_msg'];
parent::__construct($msg, $code);
}
示例8: assert
/**
* Create a new AnewtException.
*
* \param $fmt
* A error message, optionally with sprintf format specifiers
* \param $args
* Zero or more values passed to vsprintf
*/
function __construct($fmt, $args = null)
{
$args = func_get_args();
$fmt = array_shift($args);
assert('is_string($fmt);');
parent::__construct(vsprintf($fmt, $args));
}
示例9: __construct
/**
* Constructor
*
* @param string $message If no message is given 'Method Not Allowed' will be the message
* @param int $code Status code, defaults to 405
*/
public function __construct($message = null, $code = 405)
{
if (empty($message)) {
$message = 'Method Not Allowed';
}
parent::__construct($message, $code);
}
示例10: __construct
public function __construct(&$Variable, array $arrRequireTypes = array(), $sVarName = null)
{
$this->Variable =& $Variable;
$this->sVarName = $sVarName;
$this->arrRequireTypes =& $arrRequireTypes;
parent::__construct("变量%s类型为:%s,不满足要求的类型: %s", array($this->sVarName ?: '', Type::reflectType($this->Variable), implode(",", $this->arrRequireTypes)));
}
示例11: __construct
/**
* Constructor.
*
* @param string $message
* @param integer $code
* @param string $file
* @param integer $line
* @param array $trace
*/
public function __construct($message, $code, $file, $line, $trace)
{
parent::__construct($message, $code);
$this->file = $file;
$this->line = $line;
$this->trace = $trace;
}
示例12: __construct
/**
* Constructor
*
* @param string $message If no message is given 'Unauthorized' will be the message
* @param int $code Status code, defaults to 401
*/
public function __construct($message = null, $code = 401)
{
if (empty($message)) {
$message = 'Unauthorized';
}
parent::__construct($message, $code);
}
示例13: __construct
public function __construct($className, $message = null, \Exception $previous = null, $code = 0)
{
if (is_null($message)) {
$message = sprintf("Class is not an interactor: %s", $className);
}
parent::__construct($message, $code, $previous);
}
示例14: __construct
public function __construct($message, $code, $query = '')
{
parent::__construct($message, $code);
$this->last_query = $query;
$this->error = $message;
$this->errno = $code;
}
示例15: __construct
public function __construct($msg, $domain = null, $params = [])
{
$this->msgId = $msg;
$this->msgDomain = $domain;
$this->msgParams = $params;
parent::__construct($msg);
}