ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Language\ComponentTranslation\PluralFormKey Class Reference

A form of a plural message of a migrated module in a flat identifier => value map (admin GUI rows, local changes, three-way comparison, export/import): <identifier> [<form>], e.g. More...

+ Collaboration diagram for ILIAS\Language\ComponentTranslation\PluralFormKey:

Static Public Member Functions

static of (string $identifier, int $form)
 
static parse (string $key)
 

Detailed Description

A form of a plural message of a migrated module in a flat identifier => value map (admin GUI rows, local changes, three-way comparison, export/import): <identifier> [<form>], e.g.

poll_population [1]. The database holds only the identifier with its default value, see MigratedLanguageFileSync::collapsePluralForms().

Only counts as a form key where the identifier is a plural message (shipped or in the overlay); a legacy identifier that merely looks like one stays ordinary.

Definition at line 31 of file PluralFormKey.php.

Member Function Documentation

◆ of()

static ILIAS\Language\ComponentTranslation\PluralFormKey::of ( string  $identifier,
int  $form 
)
static

Definition at line 33 of file PluralFormKey.php.

33 : string
34 {
35 return sprintf('%s [%d]', $identifier, $form);
36 }

Referenced by ILIAS\Language\Tests\ComponentTranslation\PluralFormKeyTest\testOfAndParseRoundTrip(), and ILIAS\Language\Tests\ComponentTranslation\PluralFormKeyTest\testOfFormatsTheIdentifierAndForm().

+ Here is the caller graph for this function:

◆ parse()

static ILIAS\Language\ComponentTranslation\PluralFormKey::parse ( string  $key)
static
Returns
array{0: string, 1: int}|null identifier and form of a key shaped like of(), otherwise null

Definition at line 41 of file PluralFormKey.php.

41 : ?array
42 {
43 if (preg_match('/\A(.+) \[(0|[1-9]\d?)\]\z/s', $key, $matches) !== 1) {
44 return null;
45 }
46
47 return [$matches[1], (int) $matches[2]];
48 }

References ILIAS\Repository\int().

Referenced by ILIAS\Language\ComponentTranslation\IdentifierUniqueness\candidatesOf(), ILIAS\Language\Tests\ComponentTranslation\PluralFormKeyTest\testOfAndParseRoundTrip(), ILIAS\Language\Tests\ComponentTranslation\PluralFormKeyTest\testParseAcceptsTheHighestSupportedTwoDigitForm(), ILIAS\Language\Tests\ComponentTranslation\PluralFormKeyTest\testParseRejectsAThreeDigitForm(), and ILIAS\Language\Tests\ComponentTranslation\PluralFormKeyTest\testParseReturnsNullForAnythingNotShapedLikeOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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