• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP RuntimeException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testDefFormatWithPreviousException

 public function testDefFormatWithPreviousException()
 {
     $formatter = new JsonFormatter();
     $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?'));
     $formattedPrevException = $this->formatException($exception->getPrevious());
     $formattedException = $this->formatException($exception, $formattedPrevException);
     $message = $this->formatRecordWithExceptionInContext($formatter, $exception);
     $this->assertContextContainsFormattedException($formattedException, $message);
 }
开发者ID:naldz,项目名称:cyberden,代码行数:9,代码来源:JsonFormatterTest.php


示例2: testDefFormatWithPreviousException

 public function testDefFormatWithPreviousException()
 {
     $formatter = new JsonFormatter();
     $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?'));
     $message = $formatter->format(array('level_name' => 'CRITICAL', 'channel' => 'core', 'context' => array('exception' => $exception), 'datetime' => new \DateTime(), 'extra' => array(), 'message' => 'foobar'));
     if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
         $pathPrevious = substr(json_encode($exception->getPrevious()->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
         $pathException = substr(json_encode($exception->getFile(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 1, -1);
     } else {
         $pathPrevious = substr(json_encode($exception->getPrevious()->getFile()), 1, -1);
         $pathException = substr(json_encode($exception->getFile()), 1, -1);
     }
     $this->assertEquals('{"level_name":"CRITICAL","channel":"core","context":{"exception":{"class":"RuntimeException","message":"' . $exception->getMessage() . '","code":' . $exception->getCode() . ',"file":"' . $pathException . ':' . $exception->getLine() . '","previous":{"class":"LogicException","message":"' . $exception->getPrevious()->getMessage() . '","code":' . $exception->getPrevious()->getCode() . ',"file":"' . $pathPrevious . ':' . $exception->getPrevious()->getLine() . '"}}},"datetime":' . json_encode(new \DateTime()) . ',"extra":[],"message":"foobar"}' . "\n", $message);
 }
开发者ID:jorjoh,项目名称:Varden,代码行数:14,代码来源:JsonFormatterTest.php


示例3: __construct

 public function __construct($invalidHelper, array $supportedHelpers, \Exception $previous = null)
 {
     $message = sprintf('Unsupported helper "%s". It must be one of %s.', $invalidHelper, implode(', ', $supportedHelpers));
     parent::__construct($message, 0, $previous);
     $this->invalidHelper = $invalidHelper;
     $this->supportedHelpers = $supportedHelpers;
 }
开发者ID:Symfomany,项目名称:laravelcinema,代码行数:7,代码来源:UnsupportedHelperException.php


示例4: __construct

 /**
  * Public constructor.
  */
 public function __construct()
 {
     $message = 'You must authenticate to access this resource.';
     $code = 401;
     $this->statusCode = $code;
     parent::__construct($message, $code);
 }
开发者ID:marcelbonnet,项目名称:slim-auth,代码行数:10,代码来源:HttpUnauthorizedException.php


示例5: __construct

 public function __construct($method, array $allowedMethods, \Exception $previous = null)
 {
     $message = sprintf('Method "%s" is not allowed and must be one of "%s".', $method, implode(', ', $allowedMethods));
     parent::__construct($message, 0, $previous);
     $this->method = $method;
     $this->allowedMethods = $allowedMethods;
 }
开发者ID:RomainOliva,项目名称:projetFramework,代码行数:7,代码来源:MethodNotAllowedException.php


示例6: __construct

 public function __construct($message = "", $code = 403, Exception $previous = null)
 {
     if (empty($message)) {
         $message = \JText::_('LIB_FOF_VIEW_POSSIBLYSUHOSIN');
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:Joal01,项目名称:fof,代码行数:7,代码来源:PossiblySuhosin.php


示例7: __construct

 /**
  *
  * @param string $message
  * @param integer $statusCode
  * @param \Exception $previous
  * @param array $errors
  * @param array $headers
  */
 public function __construct($message, $statusCode = 0, \Exception $previous = null, array $errors = [], array $headers = [])
 {
     $this->statusCode = $statusCode;
     $this->headers = $headers;
     $this->errors = $errors;
     parent::__construct($message, $statusCode, $previous);
 }
开发者ID:Temsi,项目名称:php-hypermedia-api,代码行数:15,代码来源:APIException.php


示例8: __construct

 /**
  * Create an exception based on LibXMLError objects
  *
  * @param array $errors Array of LibXMLError objects
  * @see http://www.php.net/manual/en/class.libxmlerror.php
  */
 public function __construct(array $errors)
 {
     $numErrors = count($errors);
     if (1 == $numErrors) {
         $message = "An error occurred ";
     } elseif ($numErrors > 1) {
         $message = "Some errors occurred ";
     }
     $message .= "while parsing XML configuration file:\n";
     foreach ($errors as $error) {
         $message .= " - ";
         switch ($error->level) {
             case LIBXML_ERR_WARNING:
                 $message .= "Warning {$error->code}: ";
                 break;
             case LIBXML_ERR_ERROR:
                 $message .= "Error {$error->code}: ";
                 break;
             case LIBXML_ERR_FATAL:
                 $message .= "Fatal Error {$error->code}: ";
                 break;
         }
         $message .= $error->message;
     }
     parent::__construct($message);
 }
开发者ID:disider,项目名称:Propel2,代码行数:32,代码来源:XmlParseException.php


示例9: WrongTypeException

 public function WrongTypeException($msg = null)
 {
     if (is_null($msg)) {
         $msg = "Tipo inválido";
     }
     parent::__construct($msg);
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:7,代码来源:WrongTypeException.php


示例10: __construct

 /**
  * Creates an instance.
  *
  * @param string     $optionKey
  * @param int        $target
  * @param \Exception $previous
  */
 public function __construct($optionKey, $target, \Exception $previous = null)
 {
     $this->optionKey = $optionKey;
     $this->target = $target;
     $message = sprintf('Missing value for option "%s" in "%s"', $optionKey, $this->getTargetFQCN());
     parent::__construct($message, 0, $previous);
 }
开发者ID:utrenkner,项目名称:YAWIK,代码行数:14,代码来源:MissingOptionException.php


示例11: __construct

 /**
  * @param string $message
  * @param string $actorId
  * @param \DateTimeInterface $sinceDate
  * @param \DateTimeInterface $actualDate
  */
 public function __construct($message, $actorId, \DateTimeInterface $sinceDate, \DateTimeInterface $actualDate)
 {
     parent::__construct($message);
     $this->actorId = $actorId;
     $this->sinceDate = $sinceDate;
     $this->actualDate = $actualDate;
 }
开发者ID:cultuurnet,项目名称:udb3-udb2-bridge,代码行数:13,代码来源:OutdatedXmlRepresentationException.php


示例12: __construct

 public function __construct($errorCode, $message, $requestId, $hostId)
 {
     parent::__construct($message);
     $this->requestId = $requestId;
     $this->hostId = $hostId;
     $this->errorCode = $errorCode;
 }
开发者ID:a07061625,项目名称:upload,代码行数:7,代码来源:ServiceException.php


示例13: __construct

 public function __construct($message = NULL, $code = 0, \Exception $previous = NULL)
 {
     if (!isset($message)) {
         $message = "rowCount() is supported for DELETE, INSERT, or UPDATE statements performed with structured query builders only, since they would not be portable across database engines otherwise. If the query builders are not sufficient, set the 'return' option to Database::RETURN_AFFECTED to get the number of affected rows.";
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:7,代码来源:RowCountException.php


示例14: App42Exception3

 public function App42Exception3($detailMessage, $httpErrorCode, $appErrorCode)
 {
     $this->detailMessage = $detailMessage;
     $this->httpErrorCode = $httpErrorCode;
     $this->appErrorCode = $appErrorCode;
     return parent::__construct($detailMessage, $httpErrorCode);
 }
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:7,代码来源:App42Exception.php


示例15: __construct

 public function __construct($name, $value = null, $message = null, $code = 0, \Exception $prevException = null)
 {
     $this->argumentName = $name;
     $this->argumentValue = $value;
     $message = $message ?: sprintf('The argument for "%s" is invalid.', $name);
     parent::__construct($message, $code, $prevException);
 }
开发者ID:deepfreeze,项目名称:stream,代码行数:7,代码来源:InvalidArgumentException.php


示例16: WrongTypeException

 public function WrongTypeException($msg = null)
 {
     if ($msg == null) {
         $msg = "Esta planilha contem um formato inválido de acordo com os padrões definidos.";
     }
     parent::__construct($msg);
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:7,代码来源:WrongFormatException.php


示例17: __construct

 /**
  * @param AggregateRootIdentifier $identifier
  * @param int                     $expectedVersion
  * @param int                     $actualVersion
  */
 public function __construct(AggregateRootIdentifier $identifier, $expectedVersion, $actualVersion)
 {
     $this->identifier = $identifier;
     $this->expectedVersion = (int) $expectedVersion;
     $this->actualVersion = (int) $actualVersion;
     parent::__construct(sprintf('Got an unexpected version [%d] instead of [%d] for aggregate [%s].', $this->actualVersion, $this->expectedVersion, $identifier->toString()));
 }
开发者ID:rayrutjes,项目名称:domain-foundation,代码行数:12,代码来源:ConflictingAggregateVersionException.php


示例18: __construct

 public function __construct($message = null, $code = null, \Exception $previous = null)
 {
     if (is_null($message)) {
         $message = 'The model for Dobee is invalid!';
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:wernerdweight,项目名称:dobee,代码行数:7,代码来源:InvalidModelConfigurationException.php


示例19: __construct

 /**
  * Constructor.
  *
  * @param string    $message  The exception message
  * @param string    $id       The identifier of the content where the exception was created
  * @param Exception $previous The previous exception
  */
 public function __construct($message, $id = null, \Exception $previous = null)
 {
     $this->rawMessage = $message;
     $this->id = $id;
     $this->updateRepr();
     parent::__construct($this->message, 0, $previous);
 }
开发者ID:spress,项目名称:spress,代码行数:14,代码来源:RenderException.php


示例20: __construct

 public function __construct($message, $code = null, $previous = null)
 {
     if ($code === null) {
         $code = self::UNKNOWN_EXCEPTION;
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:margery,项目名称:thelia,代码行数:7,代码来源:ResourceException.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP S类代码示例发布时间:2022-05-23
下一篇:
PHP RunnerPage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap