|
MediaWiki master
|
Formal. More...
Public Member Functions | |
| __construct (private readonly Provider $provider,) | |
| Initializes the Formal handler with the provider. | |
| process (array $options) | |
| Selects the appropriate text form based on formality. | |
Formal.
The Formal class selects the appropriate text form (formal or informal) based on a language-specific formality index. It loads the index from a JSON file and returns either the formal or informal variant provided in the options.
Usage Example: echo $formal->process( [ 'Du hast', 'Sie haben' ] );
Definition at line 27 of file Formal.php.
| Wikimedia\Leximorph\Handler\Formal::__construct | ( | private readonly Provider | $provider | ) |
Initializes the Formal handler with the provider.
| Provider | $provider | The provider instance to use. |
Definition at line 36 of file Formal.php.
| Wikimedia\Leximorph\Handler\Formal::process | ( | array | $options | ) |
Selects the appropriate text form based on formality.
Given an array of options containing a formal form and an informal form (with the informal form defaulting to the formal form if not provided), this method returns the form that matches the language-specific formality index loaded from configuration.
| string[] | $options | An array with the formal and informal text variants. |
Definition at line 53 of file Formal.php.