1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace OpenSearch;
6:
7: // @phpstan-ignore classConstant.deprecatedClass
8: @trigger_error(LegacyTransportWrapper::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED);
9:
10: /**
11: * Transport that wraps the legacy transport.
12: *
13: * @deprecated in 2.4.0 and will be removed in 3.0.0. Use PsrTransport instead.
14: */
15: class LegacyTransportWrapper implements TransportInterface
16: {
17: public function __construct(
18: protected Transport $transport,
19: ) {
20: }
21:
22: /**
23: * {@inheritdoc}
24: */
25: public function sendRequest(
26: string $method,
27: string $uri,
28: array $params = [],
29: mixed $body = null,
30: array $headers = [],
31: ): iterable|string|null {
32: // Provide legacy support for options.
33: $options = $headers;
34: $promise = $this->transport->performRequest($method, $uri, $params, $body, $options);
35: return $this->transport->resultOrFuture($promise, $options);
36: }
37:
38: }
39: