Language
Language renderer class. This class is responsible for managing language properties such as name, locale, and weight. It retrieves these properties from the configuration object and provides methods to access them. It also ensures that the properties exist and are not empty, throwing an exception if they are.
Table of Contents
Properties
Methods
- __construct() : mixed
- __toString() : string
- Returns the current language.
- getLocale() : string|null
- Returns the locale of the current or of the given language code.
- getName() : string|null
- Returns the name of the current or of the given language code.
- getWeight() : int
- Returns the weight of the current or of the given language code.
- hasProperty() : bool
- Checks if the given property exists for the current language.
Properties
$config
Configuration object.
protected
Config
$config
$language
Current language code.
protected
string
$language
Methods
__construct()
public
__construct(Config $config[, string|null $language = null ]) : mixed
Parameters
- $config : Config
- $language : string|null = null
__toString()
Returns the current language.
public
__toString() : string
Return values
stringgetLocale()
Returns the locale of the current or of the given language code.
public
getLocale([string|null $language = null ]) : string|null
Parameters
- $language : string|null = null
Return values
string|nullgetName()
Returns the name of the current or of the given language code.
public
getName([string|null $language = null ]) : string|null
Parameters
- $language : string|null = null
Return values
string|nullgetWeight()
Returns the weight of the current or of the given language code.
public
getWeight([string|null $language = null ]) : int
Parameters
- $language : string|null = null
Return values
inthasProperty()
Checks if the given property exists for the current language.
private
hasProperty(string $property) : bool
Parameters
- $property : string