|
MediaWiki master
|
Manager. More...
Public Member Functions | |
| __construct (string $langCode, ?LoggerInterface $logger=null) | |
| Initializes a new Manager instance with a default language code. | |
| getBidi () | |
| Get the Bidi handler. | |
| getFormal () | |
| Get the Formal handler. | |
| getGender () | |
| Get the Gender handler. | |
| getGrammar () | |
| Get the Grammar handler. | |
| getPlural () | |
| Get the Plural handler. | |
Protected Member Functions | |
| getSpecArgs (array $spec, LoggerInterface $logger) | |
| Builds the constructor arguments. | |
| getSpecMap () | |
| Get the handler spec map. | |
Manager.
This class is responsible for instantiating Leximorph handler objects (Grammar, Formal, Gender, Bidi, and Plural) using Wikimedia’s ObjectFactory. The Manager holds a default language code that is injected into language-specific handlers.
Note that Gender and Bidi handlers are language independent.
Usage Example: $manager = new Manager( 'en', new NullLogger() ); $pluralHandler = $manager->getPlural(); echo $pluralHandler->process( 3, [ 'article', 'articles' ] );
Definition at line 41 of file Manager.php.
| Wikimedia\Leximorph\Manager::__construct | ( | string | $langCode, |
| ?LoggerInterface | $logger = null ) |
Initializes a new Manager instance with a default language code.
| string | $langCode | The default language code. |
| ?LoggerInterface | $logger | Optional logger; defaults to NullLogger. |
Definition at line 92 of file Manager.php.
| Wikimedia\Leximorph\Manager::getBidi | ( | ) |
| Wikimedia\Leximorph\Manager::getFormal | ( | ) |
| Wikimedia\Leximorph\Manager::getGender | ( | ) |
| Wikimedia\Leximorph\Manager::getGrammar | ( | ) |
| Wikimedia\Leximorph\Manager::getPlural | ( | ) |
|
protected |
Builds the constructor arguments.
| array<string,mixed> | $spec |
Definition at line 117 of file Manager.php.
|
protected |
Get the handler spec map.
Returns an array of handler specs indexed by class name.
Definition at line 105 of file Manager.php.