MediaWiki master
ReadableNumericSerialMapping.php
Go to the documentation of this file.
1<?php
2
4
11 private readonly int $offset;
12
13 public function __construct( array $config ) {
14 $this->offset = $config['offset'] ?? 0;
15 }
16
17 public function getSerialIdForIndex( int $index ): string {
18 $mapped = (string)( $index + $this->offset );
19 return rtrim( chunk_split( $mapped, 5, '-' ), '-' );
20 }
21}
Simple serial mapping for ASCII decimal numbers with hyphens for readability.
Interface for integer to string mappings for temporary user autocreation.