|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author Dmitry Gladyshev <[email protected]> |
|
4
|
|
|
* @date 17/08/2016 13:16 |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Yandex\Direct\Exception; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class TransportRequestException |
|
11
|
|
|
* @package Yandex\Direct\Exception |
|
12
|
|
|
*/ |
|
13
|
|
|
class TransportRequestException extends RuntimeException |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var string |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $requestHeaders; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $requestBody; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var string |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $responseHeaders; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $responseBody; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* TransportRequestException constructor. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $message |
|
39
|
|
|
* @param int $code |
|
40
|
|
|
* @param array $requestHeaders |
|
41
|
|
|
* @param string $requestBody |
|
42
|
|
|
* @param array $responseHeaders |
|
43
|
|
|
* @param string $responseBody |
|
44
|
|
|
* @param \Exception|null|Exception $previous |
|
45
|
|
|
*/ |
|
46
|
|
|
public function __construct( |
|
47
|
|
|
$message, |
|
48
|
|
|
$code, |
|
49
|
|
|
$requestHeaders = [], |
|
50
|
|
|
$requestBody = '', |
|
51
|
|
|
$responseHeaders = [], |
|
52
|
|
|
$responseBody = '', |
|
53
|
|
|
\Exception $previous = null |
|
54
|
|
|
) { |
|
55
|
|
|
|
|
56
|
|
|
$this->requestBody = $requestBody; |
|
57
|
|
|
$this->requestHeaders = $requestHeaders; |
|
|
|
|
|
|
58
|
|
|
$this->responseBody = $responseBody; |
|
59
|
|
|
$this->responseHeaders = $responseHeaders; |
|
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
parent::__construct($message, $code, $previous); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return string |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getRequestHeaders() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->requestHeaders; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return string |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getRequestBody() |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->requestBody; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return string |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getResponseHeaders() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->responseHeaders; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return string |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getResponseBody() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->responseBody; |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..