<commit_before><?php
namespace common\components\helpers;

use Yii;

/**
 * GeoIP helper application wrapper class for dpodium/yii2-geoip component.
 *
 * @author <NAME> <<EMAIL>>
 */
class GeoIPHelper
{
    /**
     * Returns valid application language key code based on GeoIP country code.
     * @param  string $default The default return value if client IP doesn't exist.
     * @return string
     */
    public static function detectLanguageCode($default = 'en')
    {
        try {
            $countryCode = strtolower(Yii::$app->geoip->lookupCountryCode());
        } catch (\Exception $e) {
            $countryCode = strtolower($default);
        }

        if ($countryCode === 'bg') {
            $lang = 'bg';
        } elseif ($countryCode === 'pl') {
            $lang = 'pl';
        } elseif ($countryCode === 'fr') {
            $lang = 'fr';
        } elseif ($countryCode === 'br' || $countryCode === 'pt' || $countryCode === 'pt-br') {
            $lang = 'pt-br';
        } else {
            $lang = $default;
        }

        return $lang;
    }
}<commit_msg>added german countrycode definition to GeoIPHelper<commit_after><?php
namespace common\components\helpers;

use Yii;

/**
 * GeoIP helper application wrapper class for dpodium/yii2-geoip component.
 *
 * @author <NAME> <<EMAIL>>
 */
class GeoIPHelper
{
    /**
     * Returns valid application language key code based on GeoIP country code.
     * @param  string $default The default return value if client IP doesn't exist.
     * @return string
     */
    public static function detectLanguageCode($default = 'en')
    {
        try {
            $countryCode = strtolower(Yii::$app->geoip->lookupCountryCode());
        } catch (\Exception $e) {
            $countryCode = strtolower($default);
        }

        if ($countryCode === 'bg') {
            $lang = 'bg';
        } elseif ($countryCode === 'pl') {
            $lang = 'pl';
        } elseif ($countryCode === 'fr') {
            $lang = 'fr';
        } elseif ($countryCode === 'de') {
            $lang = 'de';
        } elseif ($countryCode === 'br' || $countryCode === 'pt' || $countryCode === 'pt-br') {
            $lang = 'pt-br';
        } else {
            $lang = $default;
        }

        return $lang;
    }
}
{'fraction_non_alphanumeric': 0.1514486391571554, 'fraction_numerical': 0.000877963125548727, 'mean_word_length': 2.0755735492577596, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7308028', 'n_tokens_mistral': 665, 'n_tokens_neox': 661, 'n_words': 180}