當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。