fix: add array for defining Forgejo languages to merge (#61)

Closes #53

Reviewed-on: https://codeberg.org/vlw/vlw.se/pulls/61
This commit is contained in:
Victor Westerlund 2026-01-18 10:26:02 +01:00
parent 432f5218db
commit 39f270db31

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;
} }