Class FormatterLocator
A ServiceLocator implementation for loading and retaining formatter objects.
Namespace: Cake\I18n
Property Summary
-
$converted protected
bool[]
Tracks whether or not a registry entry has been converted from a FQCN to a formatter object.
-
$registry protected
array
A registry to retain formatter objects.
Method Summary
-
__construct() public
Constructor.
-
get() public
Gets a formatter from the registry by name.
-
set() public
Sets a formatter into the registry by name.
Method Detail
__construct() ¶ public
__construct(array $registry = [])
Constructor.
Parameters
-
array
$registry optional An array of key-value pairs where the key is the formatter name the value is a FQCN for the formatter.
get() ¶ public
get(string $name): Cake\I18n\FormatterInterface
Gets a formatter from the registry by name.
Parameters
-
string
$name The formatter to retrieve.
Returns
Cake\I18n\FormatterInterface
Throws
Cake\I18n\Exception\I18nException
set() ¶ public
set(string $name, string $className): void
Sets a formatter into the registry by name.
Parameters
-
string
$name The formatter name.
-
string
$className A FQCN for a formatter.
Returns
void