PHP Класс lithium\g11n\Catalog

The class is able to aggregate data from different sources which allows to complement sparse data. Not all categories must be supported by an individual adapter.
Наследование: extends lithium\core\Adaptable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_adapters Libraries::locate() compatible path to adapters for this class.
$_configurations Collection A Collection of the configurations you add through Catalog::config().

Открытые методы

Метод Описание
config ( array $config = null ) : array Sets configurations for this Adaptable implementation.
read ( mixed $name, string $category, string $locale, array $options = [] ) : array Reads data.
write ( string $name, string $category, string $locale, mixed $data, array $options = [] ) : boolean Writes data.

Описание методов

config() публичный статический Метод

Sets configurations for this Adaptable implementation.
public static config ( array $config = null ) : array
$config array Configurations, indexed by name.
Результат array `Collection` of configurations or void if setting configurations.

read() публичный статический Метод

Results are aggregated by querying all requested configurations for the requested locale then repeating this process for all locales down the locale cascade. This allows for sparse data which is complemented by data from other sources or for more generic locales. Aggregation can be controlled by either specifying the configurations or a scope to use. Usage: Catalog::read(true, 'message', 'zh'); Catalog::read('default', 'message', 'zh'); Catalog::read('default', 'validation.postalCode', 'en_US');
public static read ( mixed $name, string $category, string $locale, array $options = [] ) : array
$name mixed Provide a single configuration name as a string or multiple ones as an array which will be used to read from. Pass `true` to use all configurations.
$category string A (dot-delimeted) category.
$locale string A locale identifier.
$options array Valid options are: - `'scope'`: The scope to use. - `'lossy'`: Whether or not to use the compact and lossy format, defaults to `true`.
Результат array If available the requested data, else `null`.

write() публичный статический Метод

Usage: $data = array( 'color' => '色' ); Catalog::write('runtime', 'message', 'ja', $data);
public static write ( string $name, string $category, string $locale, mixed $data, array $options = [] ) : boolean
$name string Provide a configuration name to use for writing.
$category string A (dot-delimited) category.
$locale string A locale identifier.
$data mixed If method is used without specifying an id must be an array.
$options array Valid options are: - `'scope'`: The scope to use.
Результат boolean Success.

Описание свойств

$_adapters защищенное статическое свойство

Libraries::locate() compatible path to adapters for this class.
См. также: lithium\core\Libraries::locate()
protected static $_adapters

$_configurations защищенное статическое свойство

A Collection of the configurations you add through Catalog::config().
protected static Collection $_configurations
Результат Collection