Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupFactory Class Reference

Canonical factory for constructing YAML-configured message groups. More...

Public Member Functions

 __construct (private readonly MessageGroupTypeRegistry $typeRegistry)
 
 createGroup (array $conf)
 Construct and initialise a MessageGroupBase instance from a parsed group configuration array.
 
 resolveClass (array $conf)
 Resolve the implementation class from the configuration selector.
 

Detailed Description

Canonical factory for constructing YAML-configured message groups.

Centralises selector validation, type resolution, implementation validation, construction, and configuration initialisation that was previously spread across MessageGroupBase::factory() and its callers.

MessageGroupBase::factory() remains as a backwards-compatible static entry point and delegates here.

Since
2026.09
Author
Niklas Laxström
Siebrand Mazeland @license GPL-2.0-or-later

Definition at line 25 of file MessageGroupFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupFactory::__construct ( private readonly MessageGroupTypeRegistry $typeRegistry)

Definition at line 26 of file MessageGroupFactory.php.

Member Function Documentation

◆ createGroup()

MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupFactory::createGroup ( array $conf)

Construct and initialise a MessageGroupBase instance from a parsed group configuration array.

Exactly one of BASIC.type or BASIC.class must be present. Providing both, or neither, throws InvalidArgumentException.

Parameters
array$confParsed group configuration.
Returns
MessageGroup
Exceptions
InvalidArgumentExceptionon invalid selector or implementation.

Definition at line 42 of file MessageGroupFactory.php.

◆ resolveClass()

MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupFactory::resolveClass ( array $conf)

Resolve the implementation class from the configuration selector.

Useful for callers that need to inspect the implementation without constructing the group (e.g. schema validation, aggregate detection).

Parameters
array$confParsed group configuration.
Returns
string Fully-qualified class name.
Exceptions
InvalidArgumentExceptionon invalid or unknown selector.

Definition at line 57 of file MessageGroupFactory.php.


The documentation for this class was generated from the following file: