xref: /plugin/oauth/HttpTokenResponseException.php (revision 096e7539236e67acdb0d82d963c1d3e0b7f3c931)
1<?php
2
3namespace dokuwiki\plugin\oauth;
4
5use OAuth\Common\Http\Exception\TokenResponseException;
6
7/**
8 * Exception relating to http token response from service.
9 */
10class HttpTokenResponseException extends TokenResponseException
11{
12    protected $httpStatusCode = 0;
13    protected $httpErrorMessage = "";
14
15    /**
16     * @param string $message
17     * @param int $httpStatusCode
18     * @param string httpErrorMessage
19     * @param int $code
20     * @param \Throwable|null $previous
21     */
22    public function __construct(
23        $message = "",
24        $httpStatusCode = 0,
25        $httpErrorMessage = "",
26        $code = 0,
27        \Throwable $previous = null
28    ) {
29        parent::__construct($message, $code, $previous);
30        $this->httpStatusCode = $httpStatusCode;
31        $this->httpErrorMessage = $httpErrorMessage;
32    }
33
34    /**
35     * Get the HTTP status code
36     *
37     * @return int
38     */
39    public function getHttpStatusCode()
40    {
41        return $this->httpStatusCode;
42    }
43
44    /**
45     * Get the HTTP error message
46     *
47     * @return string
48     */
49    public function getHttpErrorMessage()
50    {
51        return $this->httpErrorMessage;
52    }
53}
54