Skip to content
Snippets Groups Projects
Commit 739390a4 authored by Liam Morland's avatar Liam Morland
Browse files

Issue #3430593: Remove use of deprecated GuzzleHttp\json_decode/json_encode()

parent 670b97c3
No related branches found
No related tags found
No related merge requests found
Pipeline #139041 passed with warnings
......@@ -10,9 +10,8 @@ use Drupal\fillpdf\FieldMapping\TextFieldMapping;
use Drupal\fillpdf\Plugin\PdfBackendBase;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Utils;
use Symfony\Component\DependencyInjection\ContainerInterface;
use function GuzzleHttp\json_decode;
use function GuzzleHttp\json_encode;
/**
* LocalServer PdfBackend plugin.
......@@ -85,7 +84,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl
'pdf' => base64_encode($pdf_content),
];
$json = json_encode($request);
$json = Utils::jsonEncode($request);
$fields = [];
......@@ -107,7 +106,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl
}
}
$fields = json_decode((string) $fields_response->getBody(), TRUE);
$fields = Utils::jsonDecode((string) $fields_response->getBody(), TRUE);
return $fields;
}
......@@ -158,7 +157,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl
'fields' => $api_fields,
];
$json = json_encode($request);
$json = Utils::jsonEncode($request);
try {
$response = $this->httpClient->post($this->configuration['local_service_endpoint'] . '/api/v1/merge', [
......@@ -166,7 +165,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl
'headers' => ['Content-Type' => 'application/json'],
]);
$decoded = json_decode((string) $response->getBody(), TRUE);
$decoded = Utils::jsonDecode((string) $response->getBody(), TRUE);
return base64_decode($decoded['pdf']);
}
catch (RequestException $e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment