Skip to content

Commit

Permalink
revert implementing LoggerAwareInterface in HTTP client decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Apr 30, 2024
1 parent c168c2c commit 67c4025
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 50 deletions.
11 changes: 1 addition & 10 deletions src/Symfony/Component/HttpClient/CachingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\HttpClient;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Component\HttpClient\Response\ResponseStream;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -33,7 +31,7 @@
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class CachingHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface
class CachingHttpClient implements HttpClientInterface, ResetInterface
{
use HttpClientTrait;

Expand Down Expand Up @@ -144,11 +142,4 @@ public function reset(): void
$this->client->reset();
}
}

public function setLogger(LoggerInterface $logger): void
{
if ($this->client instanceof LoggerAwareInterface) {
$this->client->setLogger($logger);
}
}
}
11 changes: 1 addition & 10 deletions src/Symfony/Component/HttpClient/EventSourceHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\HttpClient;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Chunk\ServerSentEvent;
use Symfony\Component\HttpClient\Exception\EventSourceException;
use Symfony\Component\HttpClient\Response\AsyncContext;
Expand All @@ -27,7 +25,7 @@
* @author Antoine Bluchet <soyuka@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
final class EventSourceHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface
final class EventSourceHttpClient implements HttpClientInterface, ResetInterface
{
use AsyncDecoratorTrait, HttpClientTrait {
AsyncDecoratorTrait::withOptions insteadof HttpClientTrait;
Expand Down Expand Up @@ -158,11 +156,4 @@ public function request(string $method, string $url, array $options = []): Respo
}
});
}

public function setLogger(LoggerInterface $logger): void
{
if ($this->client instanceof LoggerAwareInterface) {
$this->client->setLogger($logger);
}
}
}
11 changes: 1 addition & 10 deletions src/Symfony/Component/HttpClient/RetryableHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\HttpClient;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Response\AsyncContext;
use Symfony\Component\HttpClient\Response\AsyncResponse;
Expand All @@ -28,7 +27,7 @@
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class RetryableHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface
class RetryableHttpClient implements HttpClientInterface, ResetInterface
{
use AsyncDecoratorTrait;

Expand Down Expand Up @@ -164,14 +163,6 @@ public function request(string $method, string $url, array $options = []): Respo
});
}

public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
if ($this->client instanceof LoggerAwareInterface) {
$this->client->setLogger($logger);
}
}

private function getDelayFromHeader(array $headers): ?int
{
if (null !== $after = $headers['retry-after'][0] ?? null) {
Expand Down
11 changes: 1 addition & 10 deletions src/Symfony/Component/HttpClient/ThrottlingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\HttpClient;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\RateLimiter\LimiterInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
Expand All @@ -21,7 +19,7 @@
/**
* Limits the number of requests within a certain period.
*/
class ThrottlingHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface
class ThrottlingHttpClient implements HttpClientInterface, ResetInterface
{
use DecoratorTrait {
reset as private traitReset;
Expand Down Expand Up @@ -50,11 +48,4 @@ public function reset(): void
$this->traitReset();
$this->rateLimiter->reset();
}

public function setLogger(LoggerInterface $logger): void
{
if ($this->client instanceof LoggerAwareInterface) {
$this->client->setLogger($logger);
}
}
}
11 changes: 1 addition & 10 deletions src/Symfony/Component/HttpClient/UriTemplateHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

namespace Symfony\Component\HttpClient;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
use Symfony\Contracts\Service\ResetInterface;

class UriTemplateHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface
class UriTemplateHttpClient implements HttpClientInterface, ResetInterface
{
use DecoratorTrait;

Expand Down Expand Up @@ -64,13 +62,6 @@ public function withOptions(array $options): static
return $clone;
}

public function setLogger(LoggerInterface $logger): void
{
if ($this->client instanceof LoggerAwareInterface) {
$this->client->setLogger($logger);
}
}

/**
* @return \Closure(string $url, array $vars): string
*/
Expand Down

0 comments on commit 67c4025

Please sign in to comment.