Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4137847
TranslationStatsBase.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
TranslationStatsBase.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\Statistics
;
use
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups
;
use
stdClass
;
/**
* Provides some hand default implementations for TranslationStatsInterface.
* @ingroup Stats
* @license GPL-2.0-or-later
* @since 2010.07
*/
abstract
class
TranslationStatsBase
implements
TranslationStatsInterface
{
protected
TranslationStatsGraphOptions
$opts
;
public
function
__construct
(
TranslationStatsGraphOptions
$opts
)
{
$this
->
opts
=
$opts
;
}
public
function
indexOf
(
stdClass
$row
):
?
array
{
return
[
'all'
];
}
public
function
labels
():
array
{
return
[
'all'
];
}
public
function
getDateFormat
():
string
{
$dateFormat
=
'Y-m-d'
;
$scale
=
$this
->
opts
->
getValue
(
'scale'
);
if
(
$scale
===
'years'
)
{
$dateFormat
=
'Y'
;
}
elseif
(
$scale
===
'months'
)
{
$dateFormat
=
'Y-m'
;
}
elseif
(
$scale
===
'weeks'
)
{
$dateFormat
=
'Y-
\W
W'
;
}
elseif
(
$scale
===
'hours'
)
{
$dateFormat
.=
';H'
;
}
return
$dateFormat
;
}
/**
* @since 2012-03-05
* @param array $groupIds
* @return array
*/
protected
static
function
namespacesFromGroups
(
$groupIds
)
{
$namespaces
=
[];
foreach
(
$groupIds
as
$id
)
{
$group
=
MessageGroups
::
getGroup
(
$id
);
if
(
$group
)
{
$namespace
=
$group
->
getNamespace
();
$namespaces
[
$namespace
]
=
true
;
}
}
return
array_keys
(
$namespaces
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 14:20 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9d/3c/abc7ad028d17111660d7f8ce3b5e
Default Alt Text
TranslationStatsBase.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment