protected function checkFallbackLanguageLoop($source, $definitions, $fallbacks = [])
{
if (isset($definitions[$source])) {
$targets = explode(",", $definitions[$source]);
foreach ($targets as $l) {
$target = trim($l);
if ($target) {
if (in_array($target, $fallbacks)) {
throw new \Exception("Language `{$source}` | `{$target}` causes an infinte loop.");
}
$fallbacks[] = $target;
$this->checkFallbackLanguageLoop($target, $definitions, $fallbacks);
}
}
} else {
throw new \Exception("Language `{$source}` doesn't exist");
}
}