fix: add array for defining languages to merge

This commit is contained in:
Victor Westerlund 2026-01-18 09:49:07 +01:00
parent 7e01690936
commit e2d94dc4af
Signed by: vlw
GPG key ID: D0AD730E1057DFC6

View file

@ -13,7 +13,9 @@
require_once VV::root("src/Database/Tables/Languages/Languages.php"); require_once VV::root("src/Database/Tables/Languages/Languages.php");
class Forgejo { class Forgejo {
private const FORGEJO_HREF = "https://git.vlw.se/explore/repos?q=&sort=recentupdate&language="; private const MERGE_LANGUAGES = [
"Hack" => "PHP"
];
private const FORGEJO_ENDPOINT_USER = "/api/v1/users/%s"; private const FORGEJO_ENDPOINT_USER = "/api/v1/users/%s";
private const FORGEJO_ENDPOINT_SEARCH = "/api/v1/repos/search?uid=%s"; private const FORGEJO_ENDPOINT_SEARCH = "/api/v1/repos/search?uid=%s";
@ -71,6 +73,11 @@
$this->languages[$language] = 0; $this->languages[$language] = 0;
} }
// Merge language with another if exists in merge array
if (array_key_exists($language, self::MERGE_LANGUAGES)) {
$language = self::MERGE_LANGUAGES[$language];
}
// Add bytes to language in total // Add bytes to language in total
$this->languages[$language] += $bytes; $this->languages[$language] += $bytes;
} }