blob: 6e0e1575dc84060002bb50700a9b1acf8828fb24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?php
/**
* StringMangler interface.
* @file
* @author Niklas Laxström
* @license GPL-2.0-or-later
*/
/**
* Interface that key-mangling classes must implement. Mangling is done to:
* - converting characters which would be invalid in titles to something valid
* - prefixing a set of messages to avoid conflicts when sharing a namespace
* with multiple message groups.
*
* The operations have to be reversible so that
* x equals unmangle( mangle( x ) ).
*/
interface StringMangler {
/// @todo Does this really need to be in the interface???
public static function EmptyMatcher();
/**
* General way to pass configuration to the mangler.
* @param array $configuration
*/
public function setConf( $configuration );
/**
* Match strings against a pattern.
* If string matches, mangle() should mangle the key.
* @param string $string Message key.
* @return bool
*/
public function match( $string );
/**
* Mangles a list of message keys.
* @param string|string[] $data Unmangled message keys.
* @return string|string[] Mangled message keys.
*/
public function mangle( $data );
/**
* Reverses the operation mangle() did.
* @param string|string[] $data Mangled message keys.
* @return string|string[] Umangled message keys.
*/
public function unmangle( $data );
}
|