Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1429537
ThinMessage.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
ThinMessage.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\MessageLoading
;
use
stdClass
;
/**
* Message object which is based on database result row. Hence the name thin.
* Needs fields rev_user_text and those that are needed for loading revision
* text.
*
* @author Niklas Laxström
* @copyright Copyright © 2008-2010, Niklas Laxström
* @license GPL-2.0-or-later
*/
class
ThinMessage
extends
Message
{
/** This maps properties to fields in the database result row */
protected
static
array
$propertyMap
=
[
'last-translator-text'
=>
'rev_user_text'
,
'last-translator-id'
=>
'rev_user'
,
];
/** Database Result Row */
protected
?
stdClass
$row
=
null
;
/** Stored translation. */
protected
?
string
$translation
=
null
;
/**
* Set the database row this message is based on.
* @param stdClass $row Database Result Row
*/
public
function
setRow
(
stdClass
$row
):
void
{
$this
->
row
=
$row
;
}
/** Set the current translation of this message. */
public
function
setTranslation
(
string
$text
):
void
{
$this
->
translation
=
$text
;
}
/** @inheritDoc */
public
function
translation
():
?
string
{
if
(
!
isset
(
$this
->
row
)
)
{
return
$this
->
infile
();
}
return
$this
->
translation
;
}
// Re-implemented
public
function
getProperty
(
string
$key
)
{
if
(
!
isset
(
self
::
$propertyMap
[
$key
]
)
)
{
return
parent
::
getProperty
(
$key
);
}
$field
=
self
::
$propertyMap
[
$key
];
return
$this
->
row
->
$field
??
null
;
}
// Re-implemented
public
function
getPropertyNames
():
array
{
return
array_merge
(
parent
::
getPropertyNames
(),
array_keys
(
self
::
$propertyMap
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 17:43 (8 h, 50 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
47/3b/fb9ced853cba3b0116eae6a66957
Default Alt Text
ThinMessage.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment