<commit_before><?php

if (!function_exists('auth_user')) {

    /**
     * @return \Someline\Model\Foundation\User
     * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
     */
    function auth_user()
    {
        $user = app('Dingo\Api\Auth\Auth')->user(false);
        $user = !empty($user) ? $user : \Auth::user();
        if (!$user || !($user instanceof \Someline\Model\Foundation\User)) {
            throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException();
        }
        return $user;
    }

}

if (!function_exists('smart_get_client_ip')) {

    /**
     * @return array|string
     */
    function smart_get_client_ip()
    {
        $request = request();
        $clientIp = $request->header('X-Client-Ip');
        if (empty($clientIp)) {
            $clientIp = $request->getClientIp(true);
        }
        return $clientIp;
    }

}

if (!function_exists('app_timezone')) {

    /**<commit_msg>Added app_locale helper<commit_after><?php

if (!function_exists('auth_user')) {

    /**
     * @return \Someline\Model\Foundation\User
     * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
     */
    function auth_user()
    {
        $user = app('Dingo\Api\Auth\Auth')->user(false);
        $user = !empty($user) ? $user : \Auth::user();
        if (!$user || !($user instanceof \Someline\Model\Foundation\User)) {
            throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException();
        }
        return $user;
    }

}

if (!function_exists('smart_get_client_ip')) {

    /**
     * @return array|string
     */
    function smart_get_client_ip()
    {
        $request = request();
        $clientIp = $request->header('X-Client-Ip');
        if (empty($clientIp)) {
            $clientIp = $request->getClientIp(true);
        }
        return $clientIp;
    }

}

if (!function_exists('app_locale')) {

    function app_locale()
    {
        return \App::getLocale();
    }

}

if (!function_exists('app_timezone')) {

    /**
{'fraction_non_alphanumeric': 0.16220165611300535, 'fraction_numerical': 0.0, 'mean_word_length': 2.487266553480475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5268490', 'n_tokens_mistral': 642, 'n_tokens_neox': 642, 'n_words': 94}