1 | <?php |
||
32 | class Transport implements TransportInterface, LoggerAwareInterface, ConfigurableInterface |
||
33 | { |
||
34 | use ConfigurableTrait; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $baseUrl = 'https://api.direct.yandex.com'; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | private $reportsXmlSchema = 'https://api.direct.yandex.com/v5/reports.xsd'; |
||
45 | |||
46 | /** |
||
47 | * @var bool |
||
48 | */ |
||
49 | private $enableReportValidation = false; |
||
50 | |||
51 | /** |
||
52 | * @var ClientInterface |
||
53 | */ |
||
54 | private $httpClient; |
||
55 | |||
56 | /** |
||
57 | * Custom Service urls |
||
58 | * @var array |
||
59 | */ |
||
60 | private $serviceUrls = [ |
||
61 | 'Reports' => '/v5/reports' |
||
62 | ]; |
||
63 | |||
64 | /** |
||
65 | * @var array |
||
66 | */ |
||
67 | private $headers = [ |
||
68 | 'Content-Type' => 'application/json; charset=utf-8' |
||
69 | ]; |
||
70 | |||
71 | /** |
||
72 | * @var LoggerInterface |
||
73 | */ |
||
74 | private $logger; |
||
75 | |||
76 | /** |
||
77 | * @var MessageFormatter |
||
78 | */ |
||
79 | private $logMessageFormatter; |
||
80 | |||
81 | /** |
||
82 | * JsonTransport constructor. |
||
83 | * |
||
84 | * @param array $options |
||
85 | */ |
||
86 | 38 | public function __construct(array $options = []) |
|
90 | |||
91 | /** |
||
92 | * @inheritdoc |
||
93 | */ |
||
94 | 2 | public function getServiceUrl($serviceName) |
|
106 | |||
107 | /** |
||
108 | * @param array $headers |
||
109 | */ |
||
110 | 1 | public function setHeaders(array $headers) |
|
114 | |||
115 | /** |
||
116 | * @inheritdoc |
||
117 | */ |
||
118 | 1 | public function setLogger(LoggerInterface $logger) |
|
122 | |||
123 | /** |
||
124 | * @inheritdoc |
||
125 | */ |
||
126 | 1 | public function request(RequestInterface $request) |
|
163 | |||
164 | /** |
||
165 | * @return ClientInterface |
||
166 | */ |
||
167 | 1 | private function getHttpClient() |
|
177 | |||
178 | /** |
||
179 | * @return LoggerInterface |
||
180 | */ |
||
181 | 1 | private function getLogger() |
|
189 | |||
190 | /** |
||
191 | * @return MessageFormatter |
||
192 | */ |
||
193 | 1 | private function getMessageFormatter() |
|
200 | |||
201 | /** |
||
202 | * @return HandlerStack |
||
203 | */ |
||
204 | 1 | private function getHttpHandlers() |
|
213 | |||
214 | /** |
||
215 | * @param RequestInterface $request |
||
216 | * @return array |
||
217 | */ |
||
218 | 1 | private function prepareHeaders(RequestInterface $request) |
|
231 | |||
232 | /** |
||
233 | * @param RequestInterface $request |
||
234 | * @return string |
||
235 | */ |
||
236 | 1 | private function prepareBody(RequestInterface $request) |
|
245 | |||
246 | /** |
||
247 | * @param RequestInterface $request |
||
248 | * @return string |
||
249 | */ |
||
250 | 1 | private function prepareJsonBody(RequestInterface $request) |
|
257 | |||
258 | /** |
||
259 | * @param RequestInterface $request |
||
260 | * @return string |
||
261 | * @throws InvalidArgumentException |
||
262 | */ |
||
263 | private function prepareXmlBody(RequestInterface $request) |
||
278 | |||
279 | /** |
||
280 | * @param \DOMDocument $xml |
||
281 | * @throws InvalidArgumentException |
||
282 | */ |
||
283 | private function validateReportXml(\DOMDocument $xml) |
||
292 | } |
||
293 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.