Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| PlainNumericSerialMapping | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSerialIdForIndex | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | 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 | return (string)( $index + $this->offset ); |
| 19 | } |
| 20 | } |