Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7481134
MessageDefinitions.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
MessageDefinitions.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\MessageLoading
;
use
MediaWiki\Title\Title
;
/**
* Wrapper for message definitions, just to beauty the code.
* @author Niklas Laxström
* @copyright Copyright © 2007-2011, Niklas Laxström
* @license GPL-2.0-or-later
*/
class
MessageDefinitions
{
private
?
int
$namespace
;
/** @var array<string,mixed> */
private
array
$messages
;
/** @var array<string,Title>|null */
private
?
array
$pages
=
null
;
/**
* @param array<string,mixed> $messages
* @param int|false $namespace
*/
public
function
__construct
(
array
$messages
,
$namespace
=
false
)
{
$this
->
messages
=
$messages
;
$this
->
namespace
=
$namespace
===
false
?
null
:
$namespace
;
}
/** @return array<string,mixed> */
public
function
getDefinitions
():
array
{
return
$this
->
messages
;
}
/** @return array<string,Title> List of title indexed by message key. */
public
function
getPages
():
array
{
$namespace
=
$this
->
namespace
;
if
(
$this
->
pages
!==
null
)
{
return
$this
->
pages
;
}
$pages
=
[];
foreach
(
array_keys
(
$this
->
messages
)
as
$key
)
{
if
(
$namespace
===
null
)
{
// pages are in format ex. "8:jan"
[
$tns
,
$tkey
]
=
explode
(
':'
,
$key
,
2
);
$title
=
Title
::
makeTitleSafe
(
(
int
)
$tns
,
$tkey
);
}
else
{
$title
=
Title
::
makeTitleSafe
(
$namespace
,
$key
);
}
if
(
!
$title
)
{
wfWarn
(
"Invalid title ($namespace:)$key"
);
continue
;
}
$pages
[
$key
]
=
$title
;
}
$this
->
pages
=
$pages
;
return
$this
->
pages
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 12:32 (5 d, 13 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a7/3d/f9371ce70a483777f735151f584d
Default Alt Text
MessageDefinitions.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment