[李景山php]每天laravel-20161024|ArrayLoader.php

来源:互联网 发布:ai软件基础工具教程 编辑:程序博客网 时间:2024/05/17 03:12
<?phpnamespace Illuminate\Translation;// set namespaceclass ArrayLoader implements LoaderInterface{// a arrayloader to implements loader Interface    /**     * All of the translation messages.     *     * @var array     */    protected $messages = [];// the big store to save the message    /**     * Load the messages for the given locale.     *     * @param  string  $locale     * @param  string  $group     * @param  string  $namespace     * @return array     */    public function load($locale, $group, $namespace = null)    {// load the messages for the given locale.        $namespace = $namespace ?: '*';//set the default namespace        if (isset($this->messages[$namespace][$locale][$group])) {// if set then return it            return $this->messages[$namespace][$locale][$group];        }        return [];//default return null    }    /**     * Add a new namespace to the loader.     *     * @param  string  $namespace     * @param  string  $hint     * @return void     */    public function addNamespace($namespace, $hint)    {        //    }//Add a new namespace to the loader    /**     * Add messages to the loader.     *     * @param  string  $locale     * @param  string  $group     * @param  array  $messages     * @param  string|null  $namespace     * @return $this     */    public function addMessages($locale, $group, array $messages, $namespace = null)    {// Add messages to the loader        $namespace = $namespace ?: '*';//set the default namespace        $this->messages[$namespace][$locale][$group] = $messages;// set the message        return $this;// return this instance    }}
0 0
原创粉丝点击