| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\User\TempUser; |
| 4 | |
| 5 | /** |
| 6 | * Simple serial mapping for ASCII decimal numbers |
| 7 | * |
| 8 | * @since 1.39 |
| 9 | */ |
| 10 | class PlainNumericSerialMapping implements SerialMapping { |
| 11 | /** @var int */ |
| 12 | private $offset; |
| 13 | |
| 14 | /** |
| 15 | * @param array $config |
| 16 | */ |
| 17 | public function __construct( $config ) { |
| 18 | $this->offset = $config['offset'] ?? 0; |
| 19 | } |
| 20 | |
| 21 | public function getSerialIdForIndex( int $index ): string { |
| 22 | return (string)( $index + $this->offset ); |
| 23 | } |
| 24 | } |