✨ Story 4.1: page competences
This commit is contained in:
@@ -107,4 +107,31 @@ function projectImage(string $filename, string $alt, int $width, int $height, bo
|
||||
>
|
||||
</picture>
|
||||
HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compte les projets par technologie
|
||||
*/
|
||||
function getProjectCountByTech(): array
|
||||
{
|
||||
$projects = getProjects();
|
||||
$count = [];
|
||||
|
||||
foreach ($projects as $project) {
|
||||
foreach ($project['technologies'] ?? [] as $tech) {
|
||||
$count[$tech] = ($count[$tech] ?? 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les projets utilisant une technologie
|
||||
*/
|
||||
function getProjectsByTech(string $tech): array
|
||||
{
|
||||
return array_values(array_filter(getProjects(), function ($project) use ($tech) {
|
||||
return in_array($tech, $project['technologies'] ?? [], true);
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user