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:
2026-07-12 23:43:31 +02:00
parent 8e349c961b
commit 9c028aaf5e
8 changed files with 89 additions and 6 deletions
+19
View File
@@ -36,6 +36,12 @@ final class SvgRenderer
private const MARGIN_Y = 20; // top margin for month labels
private const PADDING = 10; // outer padding
/**
* Builds the full self-contained SVG heatmap for a contribution map.
*
* @param array<string, int> $contributions date (Y-m-d) => contribution count
* @param string $theme "dark" or "light"; unknown values fall back to "dark"
*/
public function render(array $contributions, string $theme = 'dark'): string
{
$colors = self::THEMES[$theme] ?? self::THEMES['dark'];
@@ -91,6 +97,9 @@ final class SvgRenderer
/**
* Builds a [week][day] grid where each cell is ['date' => 'Y-m-d', 'count' => int]
* or null if the date is in the future.
*
* @param array<string, int> $contributions date (Y-m-d) => contribution count
* @return array<int, array<int, array{date: string, count: int}|null>>
*/
private function buildGrid(\DateTimeImmutable $start, \DateTimeImmutable $today, array $contributions): array
{
@@ -125,6 +134,10 @@ final class SvgRenderer
};
}
/**
* @param array<string, int> $contributions date (Y-m-d) => contribution count
* @return array{total: int}
*/
private function computeStats(array $contributions): array
{
return ['total' => array_sum($contributions)];
@@ -132,6 +145,7 @@ final class SvgRenderer
// -------------------------------------------------------------------------
/** @param array<int, array<int, array{date: string, count: int}|null>> $grid */
private function renderMonthLabels(array $grid, string $textColor): string
{
$out = '';
@@ -183,6 +197,10 @@ final class SvgRenderer
return $out;
}
/**
* @param array<int, array<int, array{date: string, count: int}|null>> $grid
* @param array{bg: string, text: string, levels: array<int, string>} $colors
*/
private function renderCells(array $grid, array $colors): string
{
$out = '';
@@ -218,6 +236,7 @@ final class SvgRenderer
return $out;
}
/** @param array{bg: string, text: string, levels: array<int, string>} $colors */
private function renderLegend(int $totalH, array $colors): string
{
$y = $totalH - 14;