本文整理汇总了PHP中MWException::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP MWException::__construct方法的具体用法?PHP MWException::__construct怎么用?PHP MWException::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWException
的用法示例。
在下文中一共展示了MWException::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param int $httpCode HTTP status code to send to the client
* @param string|Message $content Content of the message
* @param string|Message|null $header Content of the header (\<title\> and \<h1\>)
*/
public function __construct($httpCode, $content, $header = null)
{
parent::__construct($content);
$this->httpCode = (int) $httpCode;
$this->header = $header;
$this->content = $content;
}
示例2: __construct
/**
* @todo Pass around Messages when Status class doesn't suck
* @param array $msg Message key with parameters
*/
public function __construct(array $msg)
{
$this->msg = $msg;
// Using ->plain() instead of ->text() due to bug T58226
$wikitext = call_user_func_array('wfMessage', $msg)->plain();
parent::__construct($wikitext);
}
示例3:
/**
* Construct a database error
* @param $db DatabaseBase object which threw the error
* @param $error String A simple error message to be used for debugging
*/
function __construct(DatabaseBase &$db, $error)
{
global $wgDBcluster;
$this->db = $db;
parent::__construct($error);
$isMaster = !is_null($db->getLBInfo('master'));
// Wikia change - @author macbre - MAIN-2304
\Wikia\Logger\WikiaLogger::instance()->error('DBError', ['name' => $db->getDBname(), 'cluster' => $wgDBcluster, 'server' => $db->getServer(), 'server_role' => $isMaster ? 'master' : 'slave', 'errno' => $db->lastErrno(), 'err' => $db->lastError(), 'exception' => $this]);
}
示例4: __construct
/**
* Constructor
*
* @link http://pl2.php.net/manual/en/exception.construct.php
* @param string $message
* @param int $code
* @param Exception $exception
*/
public function __construct($message = '', $code = 0, Exception $previous = null)
{
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
parent::__construct($message, $code);
$this->_previous = $previous;
} else {
parent::__construct($message, $code, $previous);
}
// log more details (macbre)
Wikia::logBacktrace(__METHOD__);
}
示例5: array
function __construct($exceptionID, $engine, $module = null, $line = null, $params = array())
{
if ($module) {
$codelocation = wfMsg('scripting-codelocation', $module, $line);
$msg = wfMsgExt("scripting-exception-{$engine}-{$exceptionID}", array(), array_merge(array($codelocation), $params));
} else {
$msg = wfMsgExt("scripting-exception-{$engine}-{$exceptionID}", array(), $params);
}
parent::__construct($msg);
$this->mExceptionID = $exceptionID;
$this->mLine = $line;
$this->mModule = $module;
$this->mParams = $params;
}
示例6: __construct
/**
* Note: these arguments are keys into wfMessage(), not text!
*
* @param string|Message $title Message key (string) for page title, or a Message object
* @param string|Message $msg Message key (string) for error text, or a Message object
* @param array $params Array with parameters to wfMessage()
*/
public function __construct($title, $msg, $params = [])
{
$this->title = $title;
$this->msg = $msg;
$this->params = $params;
// Bug 44111: Messages in the log files should be in English and not
// customized by the local wiki. So get the default English version for
// passing to the parent constructor. Our overridden report() below
// makes sure that the page shown to the user is not forced to English.
if ($msg instanceof Message) {
$enMsg = clone $msg;
} else {
$enMsg = wfMessage($msg, $params);
}
$enMsg->inLanguage('en')->useDatabase(false);
parent::__construct($enMsg->text());
}
示例7:
/**
* Note: these arguments are keys into wfMsg(), not text!
*/
function __construct($title, $msg)
{
$this->title = $title;
$this->msg = $msg;
parent::__construct(wfMsg($msg));
}
示例8:
/**
* Construct a database error
* @param DatabaseBase $db Object which threw the error
* @param string $error A simple error message to be used for debugging
*/
function __construct(DatabaseBase $db = null, $error)
{
$this->db = $db;
parent::__construct($error);
}
示例9: __construct
/**
* @param string $message
* @param string $codestr
* @param int $code
* @param array|null $extradata
*/
public function __construct($message, $codestr, $code = 0, $extradata = null)
{
parent::__construct($message, $code);
$this->mCodestr = $codestr;
$this->mExtraData = $extradata;
// This should never happen, so throw an exception about it that will
// hopefully get logged with a backtrace (T138585)
if (!is_string($codestr) || $codestr === '') {
throw new InvalidArgumentException('Invalid $codestr, was ' . ($codestr === '' ? 'empty string' : gettype($codestr)));
}
}
示例10:
/** @param string $modelId */
function __construct($modelId)
{
parent::__construct("The content model '{$modelId}' is not registered on this wiki.\n" . 'See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions ' . 'handle this content model.');
$this->modelId = $modelId;
}
示例11: array
/**
* @param string $messageName
* @param array $params
*/
function __construct($messageName, $params = array())
{
if (isset($params['args'])) {
$this->messageArgs = $params['args'];
} else {
$this->messageArgs = array();
}
if (isset($params['module']) && isset($params['line'])) {
$codeLocation = false;
if (isset($params['title'])) {
$moduleTitle = Title::newFromText($params['module']);
if ($moduleTitle && $moduleTitle->equals($params['title'])) {
$codeLocation = wfMessage('scribunto-line', $params['line'])->inContentLanguage()->text();
}
}
if ($codeLocation === false) {
$codeLocation = wfMessage('scribunto-module-line', $params['module'], $params['line'])->inContentLanguage()->text();
}
} else {
$codeLocation = '[UNKNOWN]';
}
array_unshift($this->messageArgs, $codeLocation);
$msg = wfMessage($messageName)->params($this->messageArgs)->inContentLanguage()->text();
parent::__construct($msg);
$this->messageName = $messageName;
$this->params = $params;
}
示例12:
/**
* Construct a database error
* @param Database $db The database object which threw the error
* @param string $error A simple error message to be used for debugging
*/
function __construct(Database &$db, $error)
{
$this->db =& $db;
parent::__construct($error);
}
示例13:
/**
* Note: these arguments are keys into wfMsg(), not text!
*/
function __construct($title, $msg, $params = null)
{
$this->title = $title;
$this->msg = $msg;
$this->params = $params;
if ($msg instanceof Message) {
parent::__construct($msg);
} else {
parent::__construct(wfMsg($msg));
}
}
示例14: __construct
/**
* @param string $message
* @param string $codestr
* @param int $code
* @param array|null $extradata
*/
public function __construct($message, $codestr, $code = 0, $extradata = null)
{
parent::__construct($message, $code);
$this->mCodestr = $codestr;
$this->mExtraData = $extradata;
}
示例15:
/**
* Construct a database error
* @param Database $db The database object which threw the error
* @param string $error A simple error message to be used for debugging
*/
function __construct($faultcode, $error = '')
{
$this->mFaultCode = $faultcode;
$this->mFaultText = !empty($error) ? $error : $this->getApiFaultName();
parent::__construct($this->mFaultText);
}