当前位置: 首页>>代码示例>>PHP>>正文


PHP ErrorException::__construct方法代码示例

本文整理汇总了PHP中ErrorException::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorException::__construct方法的具体用法?PHP ErrorException::__construct怎么用?PHP ErrorException::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorException的用法示例。


在下文中一共展示了ErrorException::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param string  The exception message
  * @param integer The exception code
  */
 public function __construct($message, $code, $severity, $filename, $lineno)
 {
     if (!$message) {
         throw new $this('Unknown ' . get_class($this));
     }
     parent::__construct($message, $code, $severity, $filename, $lineno);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:13,代码来源:error.php

示例2: __construct

 public function __construct($required, $code = 0, $previous = null)
 {
     if (is_string($required)) {
         $required = array($required);
     }
     parent::__construct(sprintf('One or more of required ("%s") parameters is missing!', implode('", "', $required)), $code, $previous);
 }
开发者ID:alnutile,项目名称:saucelabs_client,代码行数:7,代码来源:MissingArgumentException.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param string     $message  The Exception message to throw.
  * @param int        $code     The Exception code.
  * @param int        $severity The severity level of the exception.
  * @param string     $filename The filename where the exception is thrown.
  * @param int        $line     The line number where the exception is thrown.
  * @param \Exception $prev     The previous exception --- used for exception chaining.
  *
  * @throws ParseException Exception thrown with default message if none passed.
  */
 public function __construct(string $message = '', int $code = 0, int $severity = 1, string $filename = __FILE__, int $line = __LINE__, \Exception $prev = null)
 {
     if (!$message) {
         throw new $this('Unknown ' . get_class($this));
     }
     parent::__construct($message, $code, $severity, $filename, $line, $prev);
 }
开发者ID:adamblake,项目名称:parse,代码行数:19,代码来源:ParseException.php

示例4: __construct

 /**
  * @param string $message
  * @param int|string $http_status
  * @param null $filename
  * @param null $lineno
  * @param \Exception $previous
  */
 public function __construct($message = '', $http_status = Response::STATUS_ERROR, $filename = null, $lineno = null, \Exception $previous = null)
 {
     $code = 0;
     $this->status = $http_status;
     switch ($this->status) {
         case Response::STATUS_BAD_REQUEST:
             $code = 1;
             break;
         case Response::STATUS_METHOD_NOT_ALLOWED:
             $code = 2;
             break;
         case Response::STATUS_ERROR:
             $code = 3;
             break;
     }
     $info = array();
     if (!empty($previous)) {
         $info[] = 'caught ' . get_class($previous);
     }
     if (!empty($filename)) {
         $info[] = 'in ' . $filename;
     }
     if (!empty($lineno)) {
         $info[] = 'at line ' . $lineno;
     }
     if (!empty($info)) {
         $this->full_message = $message . ' [' . join(' ', $info) . ']';
     } else {
         $this->full_message = $message;
     }
     parent::__construct($message, $code, 1, is_null($filename) ? __FILE__ : $filename, is_null($lineno) ? __LINE__ : $lineno, $previous);
 }
开发者ID:markdown-extended,项目名称:mde-service,代码行数:39,代码来源:Error.php

示例5: __construct

 /**
  * Constructs the exception.
  * @link http://php.net/manual/en/errorexception.construct.php
  * @param $message [optional]
  * @param $code [optional]
  * @param $severity [optional]
  * @param $filename [optional]
  * @param $lineno [optional]
  * @param $previous [optional]
  */
 public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, \Exception $previous = null)
 {
     parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
     if (function_exists('xdebug_get_function_stack')) {
         $trace = array_slice(array_reverse(xdebug_get_function_stack()), 3, -1);
         foreach ($trace as &$frame) {
             if (!isset($frame['function'])) {
                 $frame['function'] = 'unknown';
             }
             // XDebug < 2.1.1: http://bugs.xdebug.org/view.php?id=695
             if (!isset($frame['type']) || $frame['type'] === 'static') {
                 $frame['type'] = '::';
             } elseif ($frame['type'] === 'dynamic') {
                 $frame['type'] = '->';
             }
             // XDebug has a different key name
             if (isset($frame['params']) && !isset($frame['args'])) {
                 $frame['args'] = $frame['params'];
             }
         }
         $ref = new \ReflectionProperty('Exception', 'trace');
         $ref->setAccessible(true);
         $ref->setValue($this, $trace);
     }
 }
开发者ID:sanggabee,项目名称:hellomedia-yii-basic,代码行数:35,代码来源:ErrorException.php

示例6: __construct

 /**
  * @param string $message
  * @param int $code
  * @param int $severity
  * @param string $filename
  * @param int $lineno
  * @param \Exception $previous
  */
 public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, \Exception $previous = null)
 {
     parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
     try {
         AppKernel::log('error', $this->getMessage(), array('code' => $code, 'exception' => $this));
     } catch (\Exception $e) {
     }
 }
开发者ID:atelierspierrot,项目名称:mvc-fundamental,代码行数:16,代码来源:ErrorException.php

示例7: __construct

 /**
  * Constructor
  *
  * @param int    $httpStatus HTTP code
  * @param string $message    messsage
  * @param int    $severity   severity
  *
  * @return void
  */
 public function __construct($message, $httpStatus = 200, array $info = array())
 {
     $trace = debug_backtrace();
     $filename = $trace[0]['file'];
     $lineno = $trace[0]['line'];
     parent::__construct($message, $httpStatus, 0, $filename, $lineno);
     $this->_info = $info;
 }
开发者ID:sssAlchemy,项目名称:Panda,代码行数:17,代码来源:Exception.php

示例8: __construct

 /**
  * Construction of the error - a message is needed (1st argument)
  *
  * @param string $message The error message
  * @param numeric $code The error code
  * @param numeric $severity The error severity code
  * @param string $filename The file name of the error
  * @param numeric $lineno The line number of the error
  * @param misc $previous The previous error if so
  */
 public function __construct($message, $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null)
 {
     // This error code is not in the error_reporting()
     if (!(error_reporting() & $code)) {
         return;
     }
     // We let the default PHP Exception manager construction
     parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
     $this->trace = parent::getTrace();
     $this->previous = parent::getPrevious();
     if (isset($php_errormsg)) {
         $this->php_error_message = $php_errormsg;
     }
     switch ($this->getCode()) {
         case E_ERROR:
         case E_USER_ERROR:
             $this->setType('fatal');
             $this->setScope('Fatal Error');
             $this->exit = true;
             break;
         case E_WARNING:
         case E_USER_WARNING:
             $this->setType('warning');
             $this->setScope('Warning');
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
         case @E_STRICT:
             $this->setType('notice');
             $this->setScope('Notice');
             break;
         case @E_RECOVERABLE_ERROR:
             $this->setType('catchable');
             $this->setScope('Catchable Error');
             break;
         case E_PARSE:
             $this->setType('parse');
             $this->setScope('Parsing Error');
             break;
         case @E_DEPRECATED:
         case @E_USER_DEPRECATED:
             $this->setType('deprecated');
             $this->setScope('Deprecated Error');
             break;
         default:
             $this->setType('unknown');
             $this->setScope('Unknown Error');
             $this->exit = true;
             break;
     }
     $dom_id = Profiler::getNewDomId($this->getType());
     $this->infos = array('message' => self::_buildExceptionStr(), 'scope' => $this->getScope(), 'type' => $this->getType(), 'file' => $this->getFile(), 'line' => $this->getLine(), 'severity' => $this->getSeverity(), 'filename' => basename($this->getFile()), 'dirname' => dirname($this->getFile()), 'dom_id' => $dom_id, 'source' => Profiler::getHighlightedSource($this->getFile(), $this->getLine()));
     $this->infos['traces'] = Profiler::getHighlightedTraces($this->getTrace(), $this->infos);
     $this->debugger = Debugger::getInstance();
     $this->debugger->addStack('message', $this->infos);
     $this->debugger->setDebuggerTitle(self::_buildExceptionStr(true), Url::getRequestUrl());
     return false;
 }
开发者ID:atelierspierrot,项目名称:devdebug,代码行数:68,代码来源:ErrorException.php

示例9: __construct

 public function __construct($message, $code, $severity, $filename, $lineno, $previous)
 {
     if ($previous instanceof Exception) {
         parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
     } else {
         parent::__construct($message, $code, $severity, $filename, $lineno);
         $this->context = $previous;
     }
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:9,代码来源:EyeErrorException.php

示例10: __construct

 /**
  * Constructor.
  *
  * @param array $arr The error array
  *
  * @codeCoverageIgnore
  */
 public function __construct(array $arr)
 {
     $message = isset($arr['message']) ? $arr['message'] : 'There was an error parsing the file';
     $code = isset($arr['code']) ? $arr['code'] : 0;
     $severity = isset($arr['type']) ? $arr['type'] : 1;
     $file = isset($arr['file']) ? $arr['file'] : __FILE__;
     $line = isset($arr['line']) ? $arr['line'] : __LINE__;
     $exception = isset($arr['exception']) ? $arr['exception'] : null;
     parent::__construct($message, $code, $severity, $file, $line, $exception);
 }
开发者ID:xeriab,项目名称:konfig,代码行数:17,代码来源:ParseException.php

示例11: __construct

 /**
  * Constructor
  *
  * @param   array  $error
  * @return  void
  */
 public function __construct(array $error)
 {
     $message = $error['message'];
     $code = isset($error['code']) ? $error['code'] : 0;
     $severity = isset($error['type']) ? $error['type'] : 1;
     $filename = isset($error['file']) ? $error['file'] : __FILE__;
     $lineno = isset($error['line']) ? $error['line'] : __LINE__;
     $exception = isset($error['exception']) ? $error['exception'] : null;
     parent::__construct($message, $code, $severity, $filename, $lineno, $exception);
 }
开发者ID:mined-gatech,项目名称:framework,代码行数:16,代码来源:ParseException.php

示例12: __construct

 /**
  * @param string|array $message [optional] The Exception message to throw.
  * @param int $code [optional] The Exception code.
  * @param int $severity [optional] The severity level of the exception.
  * @param string $filename [optional] The filename where the exception is thrown.
  * @param int $lineno [optional] The line number where the exception is thrown.
  * @param \Exception $previous [optional] The previous exception used for the exception chaining.
  */
 public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null)
 {
     if (empty($message)) {
         $message = static::getLangMessage($code);
     } elseif (is_array($message)) {
         $arReplace = $message;
         $message = static::getLangMessage($code, $arReplace);
     }
     parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
 }
开发者ID:OpenBX,项目名称:obx.core,代码行数:18,代码来源:aerror.php

示例13: __construct

 public function __construct($message = '', $code = 0, $previous = null)
 {
     if (is_an_array($message)) {
         $error = Ar($message);
         $this->column = $error->column;
         $this->message = $error->message;
     } else {
         $this->column = '(column not set)';
     }
     return parent::__construct($this->message, $code, $previous);
 }
开发者ID:brainsware,项目名称:bacon,代码行数:11,代码来源:ValidationError.php

示例14: array

 function __construct($message, $code = null, $severity = E_ERROR, $filename = null, $line = null, array $vars = array())
 {
     parent::__construct($message, $code, $severity, $filename, $line);
     $this->message = $message;
     $this->code = isset($this->codes[$code]) ? $this->codes[$code] : $code;
     $this->severity = $severity;
     $this->file = $filename;
     $this->line = $line;
     $this->vars = $vars;
     $this->logErrors();
 }
开发者ID:robotamer,项目名称:oldstuff,代码行数:11,代码来源:Error.php

示例15: __construct

 /**
  * @param string $message
  * @param int $traceOffset
  */
 public function __construct($message = "", $traceOffset = 0)
 {
     parent::__construct($message);
     $trace = $this->getTrace();
     $current = $trace[$traceOffset];
     $trace = array_slice($trace, $traceOffset + 1);
     $this->setTrace($trace);
     if (isset($current['line'])) {
         $this->setLine($current['line']);
     }
     if (isset($current['file'])) {
         $this->setFile($current['file']);
     }
 }
开发者ID:Yomyer,项目名称:cckit,代码行数:18,代码来源:FatalErrorException.php


注:本文中的ErrorException::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。