refactor: reorganise Service/ into Provider/ and Renderer/ sub-namespaces
Move all provider-related classes, enums, interface and trait into App\Service\Provider; move SvgRenderer into App\Service\Renderer. ContributionAggregator stays at the Service root as the orchestrator. Test namespaces and use statements updated to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Provider;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
|
||||
|
||||
final class ProviderHealthChecker
|
||||
{
|
||||
public function __construct(
|
||||
#[AutowireIterator('app.provider')]
|
||||
private readonly iterable $providers,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return array{status: string, providers: array<string, array<string, string>>}
|
||||
*/
|
||||
public function check(): array
|
||||
{
|
||||
$statuses = [];
|
||||
$hasError = false;
|
||||
|
||||
/** @var ProviderInterface $provider */
|
||||
foreach ($this->providers as $provider) {
|
||||
$status = $provider->probe();
|
||||
$statuses[$status->name] = $status->toArray();
|
||||
|
||||
if ($status->status === ProviderStatusType::Error) {
|
||||
$hasError = true;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => $hasError ? 'degraded' : 'ok',
|
||||
'providers' => $statuses,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user