language::line PHP Method

line() public static method

public static line ( $key, $default = '', $args = [] )
    public static function line($key, $default = '', $args = array())
    {
        $parts = explode('.', $key);
        if (count($parts) > 1) {
            $file = array_shift($parts);
            $line = array_shift($parts);
        }
        if (count($parts) == 1) {
            $file = 'global';
            $line = array_shift($parts);
        }
        if (!isset(static::$lines[$file])) {
            static::load($file);
        }
        if (isset(static::$lines[$file][$line])) {
            $text = static::$lines[$file][$line];
        } elseif ($default) {
            $text = $default;
        } else {
            $text = $key;
        }
        if (count($args)) {
            return call_user_func_array('sprintf', array_merge(array($text), $args));
        }
        return $text;
    }