2022-02-28 03:05:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MediaWiki\User\TempUser;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Simple serial mapping for ASCII decimal numbers
|
|
|
|
|
*
|
|
|
|
|
* @since 1.39
|
|
|
|
|
*/
|
|
|
|
|
class PlainNumericSerialMapping implements SerialMapping {
|
2023-12-15 18:29:51 +00:00
|
|
|
/** @var int */
|
|
|
|
|
private $offset;
|
|
|
|
|
|
2022-02-28 03:05:58 +00:00
|
|
|
/**
|
|
|
|
|
* @param array $config
|
|
|
|
|
*/
|
|
|
|
|
public function __construct( $config ) {
|
2023-12-15 18:29:51 +00:00
|
|
|
$this->offset = $config['offset'] ?? 0;
|
2022-02-28 03:05:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getSerialIdForIndex( int $index ): string {
|
2023-12-15 18:29:51 +00:00
|
|
|
return (string)( $index + $this->offset );
|
2022-02-28 03:05:58 +00:00
|
|
|
}
|
|
|
|
|
}
|