MediaWiki master
Wikimedia\Leximorph\Handler\Gender Class Reference

Gender. More...

Public Member Functions

 process (string $value, array $options)
 Selects the appropriate text variant based on gender.
 

Detailed Description

Gender.

The Gender class selects the appropriate text variant based on a provided gender value. It accepts a gender identifier along with an array of text options for male, female, and other, returning the corresponding text.

Usage Example: echo $gender->process( 'female', [ 'he', 'she', 'they' ] );

Since
1.45
Author
Doğu Abaris (abari.nosp@m.s@nu.nosp@m.ll.ne.nosp@m.t)
Note
https://www.gnu.org/copyleft/gpl.html GPL-2.0-or-later

Definition at line 25 of file Gender.php.

Member Function Documentation

◆ process()

Wikimedia\Leximorph\Handler\Gender::process ( string $value,
array $options )

Selects the appropriate text variant based on gender.

This method converts the provided gender value to lowercase and returns the text variant from the supplied options that corresponds to 'male', 'female', or a default value for any other or unspecified gender.

Parameters
string$valueThe gender value (e.g., "male", "female", or another).
string[]$optionsAn array containing text variants for male, female, and other. All three elements are optional.
Since
1.45
Returns
string The text variant that matches the provided gender.

Definition at line 41 of file Gender.php.


The documentation for this class was generated from the following file: