本文整理汇总了PHP中LogicException类的典型用法代码示例。如果您正苦于以下问题:PHP LogicException类的具体用法?PHP LogicException怎么用?PHP LogicException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogicException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler
/**
* 显示exception错误信息
* @param LogicException $e
*/
function handler($e)
{
if ($e->getCode() == 404 && !DEBUG) {
header("HTTP/1.0 404 Not Found");
exit;
}
// 正式情况下
$this->out['_msg'] = $e->getMessage();
$this->out['_code'] = $e->getCode();
// 只有LogicException才需要显示详细,记录日志
if ($e instanceof LogicException) {
// DEBUG时显示调试详细信息
if (DEBUG) {
$this->out['_exception_detail']['trace'] = $this->getTraceDesc($e->getTrace());
$this->out['_exception_detail']['file'] = $e->getFile();
$this->out['_exception_detail']['line'] = $e->getLine();
} else {
$this->out['_msg'] = '系统错误';
}
}
if (!$this->tpl) {
$this->tpl = PATH_APP . '/template/msg.tpl';
}
$this->display();
}
示例2: __construct
/**
* Constructor
*
* @param string $errorCode status error code.
* @param string $error string value of the error code.
* @param string $reason detailed message for the error.
*
* @return WindowsAzure\Common\ServiceException
*/
public function __construct($errorCode, $error = null, $reason = null)
{
parent::__construct(sprintf(Resources::AZURE_ERROR_MSG, $errorCode, $error, $reason));
$this->code = $errorCode;
$this->_error = $error;
$this->_reason = $reason;
}
示例3: __construct
public function __construct($message = '', $code = 0, \Exception $previous = null)
{
if (__CLASS__ === get_class($this)) {
trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\\Component\\Form\\Exception\\AlreadySubmittedException class instead.', E_USER_DEPRECATED);
}
parent::__construct($message, $code, $previous);
}
示例4: __construct
/**
* @param string $name
* @param \Gnugat\Redaktilo\Command\Command[] $commands
*/
public function __construct($name, array $commands)
{
$this->name = $name;
$this->commands = $commands;
$message = sprintf('The command "%s" was not found in CommandInvoker', $name);
parent::__construct($message);
}
示例5: __construct
/**
* @param string $message
* @param string $templateName
* @param int $line
* @param int $column
*/
public function __construct($message, $templateName, $line, $column)
{
parent::__construct($message);
$this->templateName = $templateName;
$this->templateLine = $line;
$this->templateColumn = $column;
}
示例6: __construct
public function __construct($message, $op1 = null, $op2 = null, $result = null)
{
$this->op1 = $op1;
$this->op2 = $op2;
$this->result = $result;
parent::__construct($message);
}
示例7: __construct
/**
* @param string $message The failure reason
* @param array $failedActions The list of failed action
* @param callable $actionArgsToString The callback function to be used to convert an action arguments to a string
* function ($action) returns string
*/
public function __construct($message, array $failedActions, $actionArgsToString = null)
{
$this->failedActions = $failedActions;
parent::__construct(sprintf('%s Actions: %s.', $message, implode(', ', array_map(function (array $action) use($actionArgsToString) {
$args = is_callable($actionArgsToString) ? call_user_func($actionArgsToString, $action) : null;
return $args !== null && empty($args) || $args === null && empty($action['args']) ? sprintf('%s()', $action['name']) : sprintf('%s(%s)', $action['name'], is_string($args) ? $args : $action['args'][0]);
}, $failedActions))));
}
示例8: __construct
/**
* {@inheritDoc}
*/
public function __construct($message = "", $translation = null, $params = [], $code = 0, \Exception $previous = null)
{
if (null !== $translation) {
$this->setTranslation($translation);
}
$this->setParams($params);
parent::__construct($message, $code, $previous);
}
示例9: __construct
public function __construct($message = null, $code = 0, \Exception $previous = null, $httpStatus = 500, $details = null)
{
$this->_httpStatus = $httpStatus;
if ($details !== null) {
$this->_details = $details;
}
parent::__construct($message, $code, $previous);
}
示例10: __construct
public function __construct($bundle, $usage, $template, array $enabled, $code = 0, \Exception $previous = null)
{
$message = sprintf('You must add %s to the assetic.bundle config to use %s in %s.', $bundle, $usage, $template);
if ($enabled) {
$message .= sprintf(' (currently enabled: %s)', implode(', ', $enabled));
}
parent::__construct($message, $code, $previous);
}
示例11: __construct
/**
* @param string $msg
* @param array $token
* @param Exception $previous
*/
public function __construct($msg, array $token, Exception $previous = null)
{
$this->token = $token;
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
parent::__construct($msg, 0, $previous);
} else {
parent::__construct($msg);
}
}
示例12: __construct
/**
* @param string $from
* @param int $to
* @param string $message
* @param int $code
* @param Exception|null $previous
*/
public function __construct($from, $to, $message = '', $code = 0, Exception $previous = null)
{
$this->from = $from;
$this->to = $to;
if (empty($message)) {
$message = sprintf('Invalid type cast: %s to %s.', $this->from, $this->to);
}
parent::__construct($message, $code, $previous);
}
示例13: __construct
/**
* @param Mixin $mixin
* @param Schema[] $schemas
*/
public function __construct(Mixin $mixin, array $schemas)
{
$this->mixin = $mixin;
$this->schemas = $schemas;
$ids = array_map(function (Schema $schema) {
return $schema->getId()->toString() . ' => ' . $schema->getClassName();
}, $schemas);
parent::__construct(sprintf('MessageResolver returned multiple messages using [%s] when one was expected. ' . 'Messages found:' . PHP_EOL . '%s', $mixin->getId()->getCurieMajor(), implode(PHP_EOL, $ids)));
}
示例14: __construct
public function __construct($type, $code = 0, Exception $previous = null)
{
$this->type = $type;
$err = "No Permission:{$type}";
if ($previous instanceof Exception) {
parent::__construct($err, $code, $previous);
} else {
parent::__construct($err, $code);
}
}
示例15: __construct
/**
* @param mixed $pattern
* @param array $searchStrategies
*/
public function __construct($pattern, array $searchStrategies)
{
$this->pattern = $pattern;
$this->searchStrategies = $searchStrategies;
$patternMessage = 'given pattern';
if (is_string($pattern) || is_int($pattern)) {
$patternMessage .= ' "' . strval($pattern) . '"';
}
$message = sprintf('The %s isn\'t supported by the Search Strategies registered in SearchEngine', $patternMessage);
parent::__construct($message);
}