diff --git a/src/SDK/Common/Http/Psr/Message/FactoryDecoratorInterface.php b/src/SDK/Common/Http/Psr/Message/FactoryDecoratorInterface.php deleted file mode 100644 index 666b19df3..000000000 --- a/src/SDK/Common/Http/Psr/Message/FactoryDecoratorInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -propagator; - } -} diff --git a/src/SDK/Common/Http/Psr/Message/RequestFactoryDecorator.php b/src/SDK/Common/Http/Psr/Message/RequestFactoryDecorator.php deleted file mode 100644 index 3eeb92d68..000000000 --- a/src/SDK/Common/Http/Psr/Message/RequestFactoryDecorator.php +++ /dev/null @@ -1,35 +0,0 @@ -decorated = $decorated; - $this->propagator = $propagator; - } - - public static function create(RequestFactoryInterface $decorated, TextMapPropagatorInterface $propagator): self - { - return new self($decorated, $propagator); - } - - public function createRequest(string $method, $uri): RequestInterface - { - return self::doCreateRequest( - $this->decorated, - $this->propagator, - $method, - $uri - ); - } -} diff --git a/src/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorInterface.php b/src/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorInterface.php deleted file mode 100644 index 3b043c48d..000000000 --- a/src/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorInterface.php +++ /dev/null @@ -1,11 +0,0 @@ -createServerRequest($method, $uri, $serverParams) - : $factory->createRequest($method, $uri); - - $headers = []; - - $propagator->inject($headers); - - foreach ($headers as $name => $value) { - $request = $request->withHeader($name, $value); - } - - return $request; - } -} diff --git a/src/SDK/Common/Http/Psr/Message/ResponseFactoryDecorator.php b/src/SDK/Common/Http/Psr/Message/ResponseFactoryDecorator.php deleted file mode 100644 index 783b2f45b..000000000 --- a/src/SDK/Common/Http/Psr/Message/ResponseFactoryDecorator.php +++ /dev/null @@ -1,40 +0,0 @@ -decorated = $decorated; - $this->propagator = $propagator; - } - - public static function create(ResponseFactoryInterface $decorated, TextMapPropagatorInterface $propagator): self - { - return new self($decorated, $propagator); - } - - /** - * @inheritDoc - */ - public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface - { - /** @psalm-suppress PossiblyUndefinedMethod */ - $response = $this->decorated->createResponse($code, $reasonPhrase); - - $headers = $response->getHeaders(); - - $this->propagator->extract($headers); - - return $response; - } -} diff --git a/src/SDK/Common/Http/Psr/Message/ResponseFactoryDecoratorInterface.php b/src/SDK/Common/Http/Psr/Message/ResponseFactoryDecoratorInterface.php deleted file mode 100644 index f5d05e92a..000000000 --- a/src/SDK/Common/Http/Psr/Message/ResponseFactoryDecoratorInterface.php +++ /dev/null @@ -1,11 +0,0 @@ -decorated = $decorated; - $this->propagator = $propagator; - } - - public static function create(ServerRequestFactoryInterface $decorated, TextMapPropagatorInterface $propagator): self - { - return new self($decorated, $propagator); - } - - /** - * @psalm-suppress MoreSpecificReturnType - * @psalm-suppress LessSpecificReturnStatement - */ - public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface - { - /** @phpstan-ignore-next-line */ - return self::doCreateRequest( - $this->decorated, - $this->propagator, - $method, - $uri, - $serverParams - ); - } -} diff --git a/src/SDK/Common/Http/Psr/Message/ServerRequestFactoryDecoratorInterface.php b/src/SDK/Common/Http/Psr/Message/ServerRequestFactoryDecoratorInterface.php deleted file mode 100644 index c14a8032d..000000000 --- a/src/SDK/Common/Http/Psr/Message/ServerRequestFactoryDecoratorInterface.php +++ /dev/null @@ -1,11 +0,0 @@ - $originalClassName - * @psalm-return MockObject&RealInstanceType - */ - abstract protected function createMock(string $originalClassName): MockObject; -} diff --git a/tests/Unit/SDK/Common/Http/Psr/Message/FactoryDecoratorTraitTest.php b/tests/Unit/SDK/Common/Http/Psr/Message/FactoryDecoratorTraitTest.php deleted file mode 100644 index 9b182888d..000000000 --- a/tests/Unit/SDK/Common/Http/Psr/Message/FactoryDecoratorTraitTest.php +++ /dev/null @@ -1,39 +0,0 @@ -createImplementation(); - $propagator = $this->createMock(TextMapPropagatorInterface::class); - - $instance->setPropagator($propagator); - - $this->assertSame( - $propagator, - $instance->getPropagator() - ); - } - - private function createImplementation(): object - { - return new class() { - use FactoryDecoratorTrait; - public function setPropagator(TextMapPropagatorInterface $propagator): void - { - $this->propagator = $propagator; - } - }; - } -} diff --git a/tests/Unit/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorTest.php b/tests/Unit/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorTest.php deleted file mode 100644 index 7bb2b08c2..000000000 --- a/tests/Unit/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorTest.php +++ /dev/null @@ -1,37 +0,0 @@ -createRequestFactoryMock($method, $uri), - $this->createPropagatorMock() - ); - - $this->assertSame( - $method, - $instance->createRequest($method, $uri)->getMethod() - ); - $this->assertSame( - $uri, - (string) $instance->createRequest($method, $uri)->getUri() - ); - } -} diff --git a/tests/Unit/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorTraitTest.php b/tests/Unit/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorTraitTest.php deleted file mode 100644 index 342d77d63..000000000 --- a/tests/Unit/SDK/Common/Http/Psr/Message/RequestFactoryDecoratorTraitTest.php +++ /dev/null @@ -1,85 +0,0 @@ -createImplementation(); - $factory = $this->createRequestFactoryMock(); - $propagator = $this->createPropagatorMock(); - - $this->assertInstanceOf( - RequestInterface::class, - $instance->createRequest( - $factory, - $propagator, - 'POST', - 'https://example.com' - ) - ); - } - - public function test_create_server_request(): void - { - $instance = $this->createImplementation(); - $factory = $this->createServerRequestFactoryMock(); - $propagator = $this->createPropagatorMock(); - - $this->assertInstanceOf( - ServerRequestInterface::class, - $instance->createRequest( - $factory, - $propagator, - 'POST', - 'https://example.com', - [] - ) - ); - } - - private function createImplementation(): object - { - return new class() { - use RequestFactoryDecoratorTrait; - - /** - * @param $factory RequestFactoryInterface|ServerRequestFactoryInterface - * @return RequestInterface|ServerRequestInterface - */ - public static function createRequest( - $factory, - TextMapPropagatorInterface $propagator, - string $method, - $uri, - array $serverParams = [] - ) { - return self::doCreateRequest( - $factory, - $propagator, - $method, - $uri, - $serverParams - ); - } - }; - } -} diff --git a/tests/Unit/SDK/Common/Http/Psr/Message/ResponseFactoryDecoratorTest.php b/tests/Unit/SDK/Common/Http/Psr/Message/ResponseFactoryDecoratorTest.php deleted file mode 100644 index 4e17b7b57..000000000 --- a/tests/Unit/SDK/Common/Http/Psr/Message/ResponseFactoryDecoratorTest.php +++ /dev/null @@ -1,37 +0,0 @@ -createResponseFactoryMock($code, $reason), - $this->createPropagatorMock() - ); - - $this->assertSame( - $code, - $instance->createResponse($code, $reason)->getStatusCode() - ); - $this->assertSame( - $reason, - $instance->createResponse($code, $reason)->getReasonPhrase() - ); - } -} diff --git a/tests/Unit/SDK/Common/Http/Psr/Message/ServerRequestFactoryDecoratorTest.php b/tests/Unit/SDK/Common/Http/Psr/Message/ServerRequestFactoryDecoratorTest.php deleted file mode 100644 index cb4235764..000000000 --- a/tests/Unit/SDK/Common/Http/Psr/Message/ServerRequestFactoryDecoratorTest.php +++ /dev/null @@ -1,37 +0,0 @@ -createServerRequestFactoryMock($method, $uri), - $this->createPropagatorMock() - ); - - $this->assertSame( - $method, - $instance->createServerRequest($method, $uri)->getMethod() - ); - $this->assertSame( - $uri, - (string) $instance->createServerRequest($method, $uri)->getUri() - ); - } -} diff --git a/tests/Unit/SDK/Common/Http/Psr/Message/UsesTextMapPropagatorTrait.php b/tests/Unit/SDK/Common/Http/Psr/Message/UsesTextMapPropagatorTrait.php deleted file mode 100644 index 5f437083c..000000000 --- a/tests/Unit/SDK/Common/Http/Psr/Message/UsesTextMapPropagatorTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -createMock(TextMapPropagatorInterface::class); - $propagator->method('inject') - ->willReturnCallback(static function (array &$carrier) { - $carrier['foo'] = 'bar'; - }); - $propagator->method('extract') - ->willReturn(Context::getCurrent()); - - return $propagator; - } -}