Skip to content

Commit

Permalink
Rename const and guard
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricziel committed Jun 16, 2024
1 parent 6694910 commit ae2de68
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Instrumentation/Symfony/src/HttpClientInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
final class HttpClientInstrumentation
{
/**
* These clients are not supported by this instrumentation.
* These clients are not supported by this instrumentation, because
* they are synchronous and do not support the on_progress option.
*/
const NON_SUPPORTED_CLIENTS = [
const SYNCHRONOUS_CLIENTS = [
/** @psalm-suppress UndefinedClass */
'\ApiPlatform\Symfony\Bundle\Test\Client',
];

public static function isSupportedImplementation(string $class): bool
public static function supportsProgress(string $class): bool
{
return false === in_array($class, self::NON_SUPPORTED_CLIENTS);
return false === in_array($class, self::SYNCHRONOUS_CLIENTS);
}

public static function register(): void
Expand Down Expand Up @@ -72,7 +73,7 @@ public static function register(): void
}

/** @psalm-suppress UndefinedClass */
if (false === self::isSupportedImplementation($class)) {
if (false === self::supportsProgress($class)) {
$context = $span->storeInContext($parent);
$propagator->inject($requestOptions['headers'], ArrayAccessGetterSetter::getInstance(), $context);

Expand Down Expand Up @@ -136,7 +137,7 @@ public static function register(): void
return;
}

if ($response !== null && false === self::isSupportedImplementation(get_class($client))) {
if ($response !== null && false === self::supportsProgress(get_class($client))) {
$span->setAttribute(TraceAttributes::HTTP_RESPONSE_STATUS_CODE, $response->getStatusCode());

if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 600) {
Expand Down

0 comments on commit ae2de68

Please sign in to comment.