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


PHP HttpException::__construct方法代码示例

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


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

示例1: __construct

 /**
  * @param string $message
  * @param int $code
  * @param \Exception $previous
  */
 public function __construct($message = null, $code = 0, \Exception $previous = null)
 {
     /*
      * @see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
      */
     parent::__construct(599, $message, $previous, array(), $code);
 }
开发者ID:bogeux,项目名称:SimpleHttpBundle,代码行数:12,代码来源:TransportException.php

示例2: __construct

 public function __construct($message = null)
 {
     if (!$message) {
         $message = $this->generic;
     }
     parent::__construct(500, $message);
 }
开发者ID:HOFB,项目名称:HOFB,代码行数:7,代码来源:DevelopersException.php

示例3: __construct

 public function __construct(ApiProblem $apiProblem, \Exception $previous = null, array $headers = array(), $code = 0)
 {
     $this->apiProblem = $apiProblem;
     $statusCode = $apiProblem->getStatusCode();
     $message = $apiProblem->getTitle();
     parent::__construct($statusCode, $message, $previous, $headers, $code);
 }
开发者ID:joshlopes,项目名称:dota2.mapapi,代码行数:7,代码来源:ApiProblemException.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param string     $message  The internal exception message
  * @param \Exception $previous The previous exception
  * @param int        $code     The internal exception code
  */
 public function __construct($message = null, \Exception $previous = null, $code = 0)
 {
     if (!$message) {
         $message = \Lang::get('api-proxy-laravel::messages.proxy_cookie_invalid');
     }
     parent::__construct(500, $message, $previous, array(), $code);
 }
开发者ID:manukn,项目名称:oauth2-server-proxify-laravel,代码行数:14,代码来源:CookieInvalidException.php

示例5: __construct

 /**
  * Create a new rate limit exceeded exception instance.
  *
  * @param string     $message
  * @param \Exception $previous
  * @param array      $headers
  * @param int        $code
  *
  * @return void
  */
 public function __construct($message = null, Exception $previous = null, $headers = [], $code = 0)
 {
     if (array_key_exists('X-RateLimit-Reset', $headers)) {
         $headers['Retry-After'] = $headers['X-RateLimit-Reset'] - time();
     }
     parent::__construct(429, $message ?: 'You have exceeded your rate limit.', $previous, $headers, $code);
 }
开发者ID:dingo,项目名称:api,代码行数:17,代码来源:RateLimitExceededException.php

示例6: __construct

 public function __construct(Validator $validator)
 {
     $errors = '';
     foreach ($validator->errors()->getMessages() as $key => $messages) {
         $errors .= implode(' ', $messages) . ' ';
     }
     parent::__construct(422, trim($errors));
 }
开发者ID:antriver,项目名称:youtube-automator,代码行数:8,代码来源:ValidationException.php

示例7: __construct

 /**
  * JsonSchemaException constructor.
  *
  * @param Error[] $errors
  */
 public function __construct(array $errors)
 {
     $messages = [];
     foreach ($errors as $error) {
         $messages[$error->getProperty()] = $error->getViolation();
     }
     parent::__construct(400, json_encode($messages));
 }
开发者ID:michaelzangerle,项目名称:RestValidationPlayground,代码行数:13,代码来源:JsonSchemaException.php

示例8: __construct

 public function __construct($servedClass = null, $userModel)
 {
     if (!$servedClass) {
         $message = $this->generic;
     } else {
         $message = "Transformer cannot serve " . get_class($userModel) . " expected [{$servedClass}]";
     }
     parent::__construct(500, $message);
 }
开发者ID:HOFB,项目名称:HOFB,代码行数:9,代码来源:UserTransformationException.php

示例9: __construct

 /**
  * Create a new resource exception instance.
  *
  * @param string                               $message
  * @param \Illuminate\Support\MessageBag|array $errors
  * @param \Exception                           $previous
  * @param array                                $headers
  * @param int                                  $code
  *
  * @return void
  */
 public function __construct($message = null, $errors = null, Exception $previous = null, $headers = [], $code = 0)
 {
     if (is_null($errors)) {
         $this->errors = new MessageBag();
     } else {
         $this->errors = is_array($errors) ? new MessageBag($errors) : $errors;
     }
     parent::__construct(422, $message, $previous, $headers, $code);
 }
开发者ID:rlacerda83,项目名称:api,代码行数:20,代码来源:ResourceException.php

示例10: __construct

 public function __construct($statusCode, array $messages)
 {
     $this->messages = $messages;
     $flattenedMessages = [];
     array_walk_recursive($messages, function ($a) use(&$flattenedMessages) {
         $flattenedMessages[] = $a;
     });
     $message = implode(' ', $flattenedMessages);
     parent::__construct($statusCode, $message);
 }
开发者ID:antriver,项目名称:ctrlv-api,代码行数:10,代码来源:InputException.php

示例11: __construct

 /**
  * ResourceException constructor.
  *
  * @param null            $message
  * @param null            $errors
  * @param \Exception|null $previous
  * @param array           $headers
  * @param int             $code
  */
 public function __construct($message = null, $errors = null, Exception $previous = null, array $headers = [], $code = 0)
 {
     parent::__construct(422, $message, $previous, $headers, $code);
     if ($errors instanceof MessageBagInterface) {
         $this->errors = $errors;
     } elseif (is_array($errors)) {
         $this->errors = new MessageBag($errors);
     } elseif ($errors instanceof Collection) {
         $this->errors = new MessageBag($errors->all());
     } else {
         $this->errors = new MessageBag();
     }
 }
开发者ID:znck,项目名称:repository,代码行数:22,代码来源:ResourceException.php

示例12: __construct

 /**
  * Create a new Service Unavailable exception instance.
  *
  * @param string $message
  * @param int $code
  * @param \Exception $previous
  */
 public function __construct($message = 'Service Unavailable.', $code = 0, Exception $previous = null)
 {
     parent::__construct(Response::HTTP_SERVICE_UNAVAILABLE, $message, $previous);
 }
开发者ID:spira,项目名称:api-core,代码行数:11,代码来源:ServiceUnavailableException.php

示例13: __construct

 public function __construct($message, $code)
 {
     parent::__construct($code, $message, null, [], $code);
 }
开发者ID:xtress,项目名称:UncleemptyMaintenanceBundle,代码行数:4,代码来源:MaintenanceException.php

示例14: __construct

 /**
  * Constructor.
  *
  * @param string    $message  The internal exception message
  * @param Exception $previous The previous exception
  * @param integer   $code     The internal exception code
  */
 public function __construct($message = null, \Exception $previous = null, $code = 0)
 {
     parent::__construct(503, $message, $previous, array(), $code);
 }
开发者ID:mohammad7293,项目名称:LexikMaintenanceBundle,代码行数:11,代码来源:ServiceUnavailableException.php

示例15: __construct

 /**
  * An enhanced constructor that allows for passing the default \Exception parameters, as well as an array of additional
  * attributes followed by any number of additional arguments that will be passed to sprintf against the message.
  *
  * @param string|null  $message    An error message string (optionally fed to sprintf if optional args are given)
  * @param int|null     $code       The error code (which should be from ORMExceptionInterface). If null, the value
  *                                 of ExceptionInterface::CODE_GENERIC will be used.
  * @param mixed        $previous   The previous exception (when re-thrown within another exception), if applicable.
  * @param mixed[]|null $attributes An optional array of attributes to pass. Will be provided in the debug output.
  * @param mixed        ...$sprintfArgs Optional additional parameters that will be passed to sprintf against the
  *                                 message string provided.
  */
 public function __construct($message = null, $code = null, $previous = null, ...$sprintfArgs)
 {
     parent::__construct($this->getFinalCode((int) $code), $this->getFinalMessage((string) $message, ...$sprintfArgs), $this->getFinalPrevious($previous), $this->getFinalCode((int) $code));
     $this->setAttributes([]);
 }
开发者ID:scr-be,项目名称:mantle-bundle,代码行数:17,代码来源:HttpException.php


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