ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
PluralFormKey.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
31final class PluralFormKey
32{
33 public static function of(string $identifier, int $form): string
34 {
35 return sprintf('%s [%d]', $identifier, $form);
36 }
37
41 public static function parse(string $key): ?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 }
49}
A form of a plural message of a migrated module in a flat identifier => value map (admin GUI rows,...
static of(string $identifier, int $form)