Esempio n. 1
0
 /**
  * Code and message positions are reverted.
  *
  * @param int    $code
  * @param string $message
  */
 public function __construct($code = null, $message = "")
 {
     if (empty($code) && empty($this->code)) {
         $code = self::NOT_FOUND;
     }
     parent::__construct($message, $code);
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Gone' will be the message
  * @param int $code Status code, defaults to 410
  */
 public function __construct($message = null, $code = 410)
 {
     if (empty($message)) {
         $message = 'Gone';
     }
     parent::__construct($message, $code);
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Not Acceptable' will be the message
  * @param int $code Status code, defaults to 406
  */
 public function __construct($message = null, $code = 406)
 {
     if (empty($message)) {
         $message = 'Not Acceptable';
     }
     parent::__construct($message, $code);
 }
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Unavailable For Legal Reasons' will be the message
  * @param int $code Status code, defaults to 451
  */
 public function __construct($message = null, $code = 451)
 {
     if (empty($message)) {
         $message = 'Unavailable For Legal Reasons';
     }
     parent::__construct($message, $code);
 }
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Service Unavailable' will be the message
  * @param int $code Status code, defaults to 503
  */
 public function __construct($message = null, $code = 503)
 {
     if (empty($message)) {
         $message = 'Service Unavailable';
     }
     parent::__construct($message, $code);
 }
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Invalid  CSRF Token' will be the message
  * @param int $code Status code, defaults to 403
  */
 public function __construct($message = null, $code = 403)
 {
     if (empty($message)) {
         $message = 'Invalid  CSRF Token';
     }
     parent::__construct($message, $code);
 }
Esempio n. 7
0
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if (!$message) {
         $message = 'Forbidden';
     }
     parent::__construct($message, 403, $previous);
 }
Esempio n. 8
0
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Forbidden' will be the message
  * @param int $code Status code, defaults to 403
  */
 public function __construct($message = null, $code = 403)
 {
     if (empty($message)) {
         $message = 'Forbidden';
     }
     parent::__construct($message, $code);
 }
Esempio n. 9
0
 /**
  * Class constructor.
  *
  * @param string          $location    The redirect URL.
  * @param int             $statusCode  The HTTP status code, 3XX.
  * @param string          $message     An optional exception message for debugging.
  * @param \Throwable|null $previous    An optional previous exception for chaining.
  *
  * @throws \RuntimeException
  */
 public function __construct($location, $statusCode = 302, $message = '', \Throwable $previous = null)
 {
     if ($statusCode < 300 || $statusCode >= 400) {
         throw new \RuntimeException('Invalid HTTP redirect status code: ' . $statusCode);
     }
     parent::__construct($statusCode, ['Location' => $location]);
 }
Esempio n. 10
0
 public function __construct($message = null, $code = 404)
 {
     if (empty($message)) {
         $message = 'Not Found';
     }
     parent::__construct($message, $code);
 }
Esempio n. 11
0
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Bad Request' will be the message
  * @param int $code Status code, defaults to 400
  */
 public function __construct($message = null, $code = 400)
 {
     if (empty($message)) {
         $message = 'Bad Request';
     }
     parent::__construct($message, $code);
 }
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Unauthorized' will be the message
  * @param int $code Status code, defaults to 401
  */
 public function __construct($message = null, $code = 401)
 {
     if (empty($message)) {
         $message = 'Unauthorized';
     }
     parent::__construct($message, $code);
 }
Esempio n. 13
0
 /**
  * @param string          $location
  * @param integer         $statusCode
  * @param string          $message
  * @param \Exception|null $previous
  */
 public function __construct($location, $statusCode = 302, $message = '', \Exception $previous = null)
 {
     if ($statusCode < 300 || $statusCode >= 400) {
         throw new \InvalidArgumentException('Invalid HTTP redirect status code: ' . $statusCode);
     }
     parent::__construct($statusCode, ['Location' => $location], $message, $previous);
 }
 public function __construct($message = '')
 {
     if (!$message) {
         $message = 'Forbidden';
     }
     parent::__construct($message, 403);
 }
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Method Not Allowed' will be the message
  * @param int $code Status code, defaults to 405
  */
 public function __construct($message = null, $code = 405)
 {
     if (empty($message)) {
         $message = 'Method Not Allowed';
     }
     parent::__construct($message, $code);
 }
Esempio n. 16
0
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if (!$message) {
         $message = 'Not Found';
     }
     parent::__construct($message, 404, $previous);
 }
Esempio n. 17
0
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Conflict' will be the message
  * @param int $code Status code, defaults to 409
  */
 public function __construct($message = null, $code = 409)
 {
     if (empty($message)) {
         $message = 'Conflict';
     }
     parent::__construct($message, $code);
 }
 /**
  * Constructor
  *
  * @param string|null $message If no message is given 'Internal Server Error' will be the message
  * @param int $code Status code, defaults to 500
  */
 public function __construct($message = null, $code = 500)
 {
     if (empty($message)) {
         $message = 'Internal Server Error';
     }
     parent::__construct($message, $code);
 }
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     if (!$message) {
         $message = 'Unauthorized';
     }
     parent::__construct($message, 401, $previous);
 }
 public function __construct($message = '')
 {
     if (!$message) {
         $message = 'Unauthorized';
     }
     parent::__construct($message, 401);
 }
Esempio n. 21
0
 public function __construct($message = '')
 {
     if (!$message) {
         $message = 'Not Found';
     }
     parent::__construct($message, 404);
 }
 /**
  * @param int $retry_after
  * @param string $message
  * @param int $code
  * @param \Exception $previous
  */
 public function __construct($retry_after = 0, $message = '', $code = 0, \Exception $previous = null)
 {
     $headers = [];
     if ($retry_after) {
         $headers = ['Retry-After' => $retry_after];
     }
     parent::__construct(429, $message, $headers, $code, $previous);
 }
 /**
  * Constructor.
  *
  * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried
  * @param string     $message    The internal exception message
  * @param Exception  $previous   The previous exception
  * @param integer    $code       The internal exception code
  */
 public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0)
 {
     $headers = array();
     if ($retryAfter) {
         $headers = array('Retry-After' => $retryAfter);
     }
     parent::__construct(429, $message, $previous, $headers, $code);
 }
 public function __construct($apiCode, $params = array(), $message = null)
 {
     $this->apiCode = $apiCode;
     $this->params = $params;
     if (empty($message)) {
         $message = 'API exception occurred';
     }
     parent::__construct($message, 418);
 }
 /**
  * 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)
 {
     parent::__construct(428, $message, $previous, array(), $code);
 }
Esempio n. 26
0
 public function __construct(array $allowedMethods)
 {
     parent::__construct(405, 'HTTP method not allowed, allowed methods: ' . implode(', ', $allowedMethods));
 }
 /**
  * Constructor.
  * @param string $message error message
  * @param integer $code error code
  * @param \Exception $previous The previous exception used for the exception chaining.
  */
 public function __construct($message = null, $code = 0, \Exception $previous = null)
 {
     parent::__construct(415, $message, $code, $previous);
 }
Esempio n. 28
0
 public function __construct($key)
 {
     parent::__construct($key . " - argument not set", 400);
 }
 /**
  * Class constructor.
  *
  * @param string          $message  An optional exception message for debugging.
  * @param \Throwable|null $previous An optional previous exception for chaining.
  */
 public function __construct($message = '', \Throwable $previous = null)
 {
     parent::__construct(503, [], $message, $previous);
 }
Esempio n. 30
0
 /**
  * HttpNotFoundException constructor.
  */
 public function __construct()
 {
     http_response_code(404);
     parent::__construct(404);
 }