1<?php
2
3namespace dokuwiki\plugin\issuelinks\classes;
4
5/**
6 * Class HTTPRequestException
7 *
8 * A translatable exception
9 *
10 * @package dokuwiki\plugin\issuelinks\classes
11 */
12class HTTPRequestException extends IssueLinksException
13{
14    protected $httpError;
15    protected $responseBody;
16    protected $url;
17    protected $method;
18
19    public function __construct($message, \DokuHTTPClient $httpClient, $url, $method)
20    {
21        $this->code = $httpClient->status;
22        $this->httpError = $httpClient->error;
23        $this->responseBody = $httpClient->resp_body;
24        $this->url = $url;
25        $this->method = $method;
26
27        parent::__construct($message, $this->getCode(), $this->httpError);
28    }
29
30    /**
31     * @return string
32     */
33    public function getHttpError()
34    {
35        return $this->httpError;
36    }
37
38    /**
39     * @return string
40     */
41    public function getResponseBody()
42    {
43        return $this->responseBody;
44    }
45
46    /**
47     * @return string
48     */
49    public function getUrl()
50    {
51        return $this->url;
52    }
53
54    /**
55     * @return string
56     */
57    public function getMethod()
58    {
59        return $this->method;
60    }
61}
62