MediaWiki REL1_35
SkinFactory Class Reference

Factory class to create Skin objects. More...

Collaboration diagram for SkinFactory:

Public Member Functions

 __construct (ObjectFactory $objectFactory)
 
 getSkinNames ()
 Returns an associative array of: skin name => human readable name.
 
 makeSkin ( $name)
 Create a given Skin using the registered callback for $name.
 
 register ( $name, $displayName, $spec)
 Register a new Skin factory function.
 

Private Attributes

array $displayNames = []
 Map of name => fallback human-readable name, used when the 'skinname-<skin>' message is not available.
 
array< string, array|callable > $factoryFunctions = []
 Map of skin name to object factory spec or factory function.
 
ObjectFactory $objectFactory
 

Detailed Description

Factory class to create Skin objects.

Since
1.24

Definition at line 31 of file SkinFactory.php.

Constructor & Destructor Documentation

◆ __construct()

SkinFactory::__construct ( ObjectFactory  $objectFactory)

Definition at line 56 of file SkinFactory.php.

Member Function Documentation

◆ getSkinNames()

SkinFactory::getSkinNames ( )

Returns an associative array of: skin name => human readable name.

Returns
array

Definition at line 97 of file SkinFactory.php.

◆ makeSkin()

SkinFactory::makeSkin (   $name)

Create a given Skin using the registered callback for $name.

Parameters
string$nameName of the skin you want
Exceptions
SkinExceptionIf a factory function isn't registered for $name
Returns
Skin

Definition at line 107 of file SkinFactory.php.

◆ register()

SkinFactory::register (   $name,
  $displayName,
  $spec 
)

Register a new Skin factory function.

Will override if it's already registered.

Parameters
string$nameInternal skin name. Should be all-lowercase (technically doesn't have to be, but doing so would change the case of i18n message keys).
string$displayNameFor backwards-compatibility with old skin loading system. This is the text used as skin's human-readable name when the 'skinname-<skin>' message is not available.
array | callable$specCallback that takes the skin name as an argument, or object factory spec specifying how to create the skin
Exceptions
InvalidArgumentExceptionIf an invalid callback is provided

Definition at line 74 of file SkinFactory.php.

Member Data Documentation

◆ $displayNames

array SkinFactory::$displayNames = []
private

Map of name => fallback human-readable name, used when the 'skinname-<skin>' message is not available.

Definition at line 45 of file SkinFactory.php.

◆ $factoryFunctions

array<string,array|callable> SkinFactory::$factoryFunctions = []
private

Map of skin name to object factory spec or factory function.

Definition at line 38 of file SkinFactory.php.

◆ $objectFactory

ObjectFactory SkinFactory::$objectFactory
private

Definition at line 49 of file SkinFactory.php.


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