Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel\Exception; Chris@0: Chris@0: /** Chris@0: * @author Ben Ramsey Chris@0: * Chris@0: * @see http://tools.ietf.org/html/rfc6585 Chris@0: */ Chris@0: class TooManyRequestsHttpException extends HttpException Chris@0: { Chris@0: /** Chris@0: * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried Chris@0: * @param string $message The internal exception message Chris@0: * @param \Exception $previous The previous exception Chris@0: * @param int $code The internal exception code Chris@0: */ Chris@0: public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) Chris@0: { Chris@17: $headers = []; Chris@0: if ($retryAfter) { Chris@17: $headers = ['Retry-After' => $retryAfter]; Chris@0: } Chris@0: Chris@0: parent::__construct(429, $message, $previous, $headers, $code); Chris@0: } Chris@0: }