<commit_before><?php

declare(strict_types=1);

/*
 * This file is part of the ************************ package.
 * _____________                           _______________
 *  ______/     \__  _____  ____  ______  / /_  _________
 *   ____/ __   / / / / _ \/ __`\/ / __ \/ __ \/ __ \___
 *    __/ / /  / /_/ /  __/ /  \  / /_/ / / / / /_/ /__
 *      \_\ \_/\____/\___/_/   / / .___/_/ /_/ .___/
 *         \_\                /_/_/         /_/
 *
 * The PHP Framework For Code Poem As Free As Wind. <Query Yet Simple>
 * (c) 2010-2020 http://queryphp.com All rights reserved.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Leevel\I18n\Proxy;

use Leevel\Di\Container;
use Leevel\I18n\I18n as BaseI18n;

/**
 * 代理 i18n.
 *
 * @codeCoverageIgnore
 */
class I18n
{
    /**
     * call.
     *
     * @return mixed
     */
    public static function __callStatic(string $method, array $args)
    {
        return self::proxy()->{$method}(...$args);
    }

    /**
     * 获取语言 text.
     *
     * @param array ...$data
     */
    public static function __(string $text, ...$data): string
    {
        return self::proxy()->__($text, ...$data);
    }

    /**
     * 获取语言 text.
     *
     * @param array ...$data
     */
    public static function gettext(string $text, ...$data): string
    {
        return self::proxy()->gettext($text, ...$data);
    }

    /**
     * 添加语言包.
     *
     * @param string $i18n 语言名字
     * @param array  $data 语言包数据
     */
    public static function addtext(string $i18n, array $data = []): void
    {
        self::proxy()->addtext($i18n, $data);
    }

    /**
     * 设置当前语言包上下文环境.
     */
    public static function setI18n(string $i18n): void
    {
        self::proxy()->setI18n($i18n);
    }

    /**
     * 获取当前语言包.
     */
    public static function getI18n(): string
    {
        return self::proxy()->getI18n();
    }

    /**
     * 返回所有语言包.
     */
    public static function all(): array
    {
        return self::proxy()->all();
    }

    /**
     * 代理服务.
     */
    public static function proxy(): BaseI18n
    {
        return Container::singletons()->make('i18n');
    }
}<commit_msg>refactor(i18n): use @ method to implement proxy ide helper<commit_after><?php

declare(strict_types=1);

/*
 * This file is part of the ************************ package.
 * _____________                           _______________
 *  ______/     \__  _____  ____  ______  / /_  _________
 *   ____/ __   / / / / _ \/ __`\/ / __ \/ __ \/ __ \___
 *    __/ / /  / /_/ /  __/ /  \  / /_/ / / / / /_/ /__
 *      \_\ \_/\____/\___/_/   / / .___/_/ /_/ .___/
 *         \_\                /_/_/         /_/
 *
 * The PHP Framework For Code Poem As Free As Wind. <Query Yet Simple>
 * (c) 2010-2020 http://queryphp.com All rights reserved.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Leevel\I18n\Proxy;

use Leevel\Di\Container;
use Leevel\I18n\I18n as BaseI18n;

/**
 * 代理 i18n.
 *
 * @method static string __(string $text, array ...$data)      获取语言 text.
 * @method static string gettext(string $text, array ...$data) 获取语言 text.
 * @method static void addtext(string $i18n, array $data = []) 添加语言包.
 * @method static void setI18n(string $i18n)                   设置当前语言包上下文环境.
 * @method static string getI18n()                             获取当前语言包.
 * @method static array all()                                  返回所有语言包.
 */
class I18n
{
    /**
     * call.
     *
     * @return mixed
     */
    public static function __callStatic(string $method, array $args)
    {
        return self::proxy()->{$method}(...$args);
    }

    /**
     * 代理服务.
     */
    public static function proxy(): BaseI18n
    {
        return Container::singletons()->make('i18n');
    }
}
{'fraction_non_alphanumeric': 0.16538461538461538, 'fraction_numerical': 0.02, 'mean_word_length': 1.6829436038514443, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '793601', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1370, 'n_words': 281}