@@ -38,6 +38,9 @@ class ApiRequest implements ApiRequestInterface
3838 /** @var bool Режим Отладки (вывод системных сообщений) */
3939 private bool $ debugModeIsOn = false ;
4040
41+ /** @var bool Формат результата в режиме отладки */
42+ private bool $ jsonDebugResponse = true ;
43+
4144 /** @inheritdoc */
4245 public function __construct (MerchantInterface $ merchant )
4346 {
@@ -211,7 +214,11 @@ private function sendGetRequest(string $api): array
211214 $ this ->echoDebugMessage ('GET-Запрос к серверу Ypmn: ' );
212215 $ this ->echoDebugMessage ($ this ->getHost () . $ api );
213216 $ this ->echoDebugMessage ('Ответ от сервера Ypmn: ' );
214- $ this ->echoDebugMessage (json_encode (json_decode ($ response ), JSON_PRETTY_PRINT ));
217+ if ($ this ->getJsonDebugResponse ()) {
218+ $ this ->echoDebugMessage (json_encode (json_decode ($ response ), JSON_PRETTY_PRINT ));
219+ } else {
220+ $ this ->echoDebugMessage ($ response );
221+ }
215222
216223 if (mb_strlen ($ err ) > 0 ) {
217224 $ this ->echoDebugMessage ('Ошибка ' );
@@ -497,6 +504,19 @@ public function setDebugMode(bool $debugModeIsOn = true): self
497504 return $ this ;
498505 }
499506
507+ /** @inheritdoc */
508+ public function setJsonDebugResponse (bool $ jsonDebugResponse ): self
509+ {
510+ $ this ->jsonDebugResponse = $ jsonDebugResponse ;
511+ return $ this ;
512+ }
513+
514+ /** @inheritdoc */
515+ public function getJsonDebugResponse (): bool
516+ {
517+ return $ this ->jsonDebugResponse ;
518+ }
519+
500520 /**
501521 * Вывод отладочного сообщения
502522 * @param $mixedInput
0 commit comments