Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4102485
MockWikiMessageGroup.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MockWikiMessageGroup.php
View Options
<?php
use
MediaWiki\Extension\Translate\Validation\ValidationRunner
;
/**
* This file contains multiple unmanaged message group implementation.
*
* @file
* @author Niklas Laxström
* @author Siebrand Mazeland
* @copyright Copyright © 2008-2013, Niklas Laxström, Siebrand Mazeland
* @license GPL-2.0-or-later
*/
class
MockWikiMessageGroup
extends
WikiMessageGroup
{
public
function
__construct
(
$id
,
array
$messages
)
{
parent
::
__construct
(
$id
,
'unused'
);
$this
->
id
=
$id
;
$this
->
messages
=
$messages
;
}
public
function
getDefinitions
()
{
return
$this
->
messages
;
}
public
function
getMessage
(
$key
,
$code
)
{
if
(
$code
===
$this
->
getSourceLanguage
()
)
{
return
$this
->
messages
[
strtolower
(
$key
)]
??
null
;
}
parent
::
getMessage
(
$key
,
$code
);
}
}
/**
* Has validators that always return a validation error and warning.
*/
class
MockWikiValidationMessageGroup
extends
MockWikiMessageGroup
{
public
function
getValidator
()
{
$validator
=
new
ValidationRunner
(
$this
->
getId
()
);
$validator
->
setValidators
(
[
[
'class'
=>
AnotherMockTranslateValidator
::
class
],
[
'class'
=>
MockTranslateValidator
::
class
,
'enforce'
=>
true
,
'include'
=>
[
'translated'
,
'untranslated'
,
[
'type'
=>
'regex'
,
'pattern'
=>
'/regex-key/'
],
[
'type'
=>
'wildcard'
,
'pattern'
=>
'*translated*'
]
],
'exclude'
=>
[
'key-excluded'
,
[
'type'
=>
'regex'
,
'pattern'
=>
'/regex-exclude/'
],
[
'type'
=>
'wildcard'
,
'pattern'
=>
'*wildcard-exclude*'
]
]
],
]
);
return
$validator
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 17:28 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6c/a3/81bc6148b2b2624ed71aa42ee61a
Default Alt Text
MockWikiMessageGroup.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment