Merge "docs: Fix typo"
[mediawiki.git] / includes / user / TempUser / ReadableNumericSerialMapping.php
blobdc6d9cc7c7280e1247a3291b79af79c9beffcf49
1 <?php
3 namespace MediaWiki\User\TempUser;
5 /**
6 * Simple serial mapping for ASCII decimal numbers with hyphens for readability
8 * @since 1.44
9 */
10 class ReadableNumericSerialMapping implements SerialMapping {
11 private int $offset;
13 /**
14 * @param array $config
16 public function __construct( $config ) {
17 $this->offset = $config['offset'] ?? 0;
20 public function getSerialIdForIndex( int $index ): string {
21 $mapped = (string)( $index + $this->offset );
22 return rtrim( chunk_split( $mapped, 5, '-' ), '-' );