Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4083613
Math.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
Math.php
View Options
<?php
namespace
MediaWiki\Extension\Math
;
use
MediaWiki\Extension\Math\InputCheck\InputCheckFactory
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLnodes\VisitorFactory
;
use
MediaWiki\MediaWikiServices
;
use
Psr\Container\ContainerInterface
;
/**
* Top level factory for the Math extension.
*
* @license GPL-2.0-or-later
*/
final
class
Math
{
private
static
?
ContainerInterface
$serviceContainer
=
null
;
/**
* @codeCoverageIgnore
*/
private
function
__construct
()
{
// should not be instantiated
}
/**
* Set a service container to override default service access.
* Only used in tests to avoid MediaWikiServices::getInstance().
*/
public
static
function
setServiceContainer
(
ContainerInterface
$container
):
void
{
self
::
$serviceContainer
=
$container
;
}
public
static
function
getMathConfig
(
?
ContainerInterface
$services
=
null
):
MathConfig
{
return
self
::
getService
(
'Math.Config'
,
$services
);
}
public
static
function
getCheckerFactory
(
?
ContainerInterface
$services
=
null
):
InputCheckFactory
{
return
self
::
getService
(
'Math.CheckerFactory'
,
$services
);
}
public
static
function
getVisitorFactory
(
?
ContainerInterface
$services
=
null
):
VisitorFactory
{
return
self
::
getService
(
'Math.MathMLTreeVisitor'
,
$services
);
}
/**
* Retrieves a service instance from the specified or default container.
* @param string $serviceName Service identifier to retrieve
* @param ContainerInterface|null $services Optional container override for unit tests
* @return mixed Service instance
*/
private
static
function
getService
(
string
$serviceName
,
?
ContainerInterface
$services
=
null
)
{
$container
=
$services
??
self
::
$serviceContainer
;
if
(
$container
)
{
return
$container
->
get
(
$serviceName
);
}
return
MediaWikiServices
::
getInstance
()->
get
(
$serviceName
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 18 2026, 07:18 (7 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e9/94/6daefa9cb3e29542dd005a53eb3f
Default Alt Text
Math.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment