docs(phpdoc): document public methods across src/
Add professional PHPDoc (summary + @param/@return) to the remaining public methods that had none or only partial coverage: GraphController's actions, ContributionStore's accessors, SvgRenderer's render() and private helpers (with concrete array-shape annotations), ProbeTrait, ProviderHealthChecker, ProviderStatus, and the Contribution entity. Also adds the matching @return shapes on SvgRendererTest's data providers.
This commit is contained in:
@@ -9,6 +9,10 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
trait ProbeTrait
|
||||
{
|
||||
/**
|
||||
* Reports NotConfigured if credentials are missing, otherwise pings the provider
|
||||
* and reports Ok or Error (with a classified error code and message).
|
||||
*/
|
||||
public function probe(): ProviderStatus
|
||||
{
|
||||
if (!$this->isConfigured()) {
|
||||
|
||||
@@ -8,13 +8,17 @@ use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
|
||||
|
||||
final class ProviderHealthChecker
|
||||
{
|
||||
/** @param iterable<ProviderInterface> $providers */
|
||||
public function __construct(
|
||||
#[AutowireIterator('app.provider')]
|
||||
private readonly iterable $providers,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return array{status: string, providers: array<string, array<string, string>>}
|
||||
* Probes every configured provider and aggregates the results for the /health endpoint.
|
||||
*
|
||||
* @return array{status: string, providers: array<string, array<string, string>>} 'status' is
|
||||
* "degraded" if any provider's probe() reported an error, otherwise "ok"
|
||||
*/
|
||||
public function check(): array
|
||||
{
|
||||
|
||||
@@ -4,8 +4,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace GitContributionGraph\Service\Provider;
|
||||
|
||||
/** Result of probing a single provider, as reported by the /health endpoint. */
|
||||
final class ProviderStatus
|
||||
{
|
||||
/**
|
||||
* @param string $name provider identifier, e.g. "github"
|
||||
* @param ProviderStatusType $status overall outcome of the probe
|
||||
* @param ?ProviderErrorCode $error classified error code, set only when $status is Error
|
||||
* @param ?string $message human-readable error detail, set only when $status is Error
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $name,
|
||||
public readonly ProviderStatusType $status,
|
||||
@@ -13,7 +20,11 @@ final class ProviderStatus
|
||||
public readonly ?string $message = null,
|
||||
) {}
|
||||
|
||||
/** @return array<string, string> */
|
||||
/**
|
||||
* Converts to the array shape used in the /health JSON response, omitting error/message when unset.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
$data = ['status' => $this->status->value];
|
||||
|
||||
Reference in New Issue
Block a user