blob: f4b523a9de46306e5772aa26e76fe42f7b2bbab8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extensions\Translate\Utilities;
/**
* Create unique placeholders that can be used when parsing (wiki)text.
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @since 2020.07
*/
class ParsingPlaceholderFactory {
private $i = 0;
/** Return value is guaranteed to only contain [a-zA-Z0-9\x7f] */
public function make(): string {
return "\x7fUNIQ" .
dechex( mt_rand( 0, 0x7fffffff ) ) .
dechex( mt_rand( 0, 0x7fffffff ) ) .
'-' .
$this->i++;
}
}
|