MediaWiki REL1_37
MediaWiki\Content\ContentHandlerFactory Class Reference
Inheritance diagram for MediaWiki\Content\ContentHandlerFactory:
Collaboration diagram for MediaWiki\Content\ContentHandlerFactory:

Public Member Functions

 __construct (array $handlerSpecs, ObjectFactory $objectFactory, HookContainer $hookContainer, LoggerInterface $logger)
 
 defineContentHandler (string $modelID, $handlerSpec)
 Define HandlerSpec for ModelID.
 
 getAllContentFormats ()
 
 getContentHandler (string $modelID)
 
 getContentModels ()
 Get defined ModelIDs.
 
 isDefinedModel (string $modelID)
 

Private Member Functions

 createContentHandlerFromHandlerSpec (string $modelID, $handlerSpec)
 
 createContentHandlerFromHook (string $modelID)
 
 createForModelID (string $modelID)
 Create ContentHandler for ModelID.
 
 validateContentHandler (string $modelID, $contentHandler)
 

Private Attributes

ContentHandler[] $handlersByModel = []
 Registry of ContentHandler instances by model id.
 
string[] callable[] $handlerSpecs
 
HookRunner $hookRunner
 
LoggerInterface $logger
 
ObjectFactory $objectFactory
 

Detailed Description

Definition at line 44 of file ContentHandlerFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Content\ContentHandlerFactory::__construct ( array  $handlerSpecs,
ObjectFactory  $objectFactory,
HookContainer  $hookContainer,
LoggerInterface  $logger 
)
Since
1.35
Access: internal
Use
See also
MediaWikiServices::getContentHandlerFactory
Parameters
string[] | callable[]$handlerSpecsAn associative array mapping each known content model to the ObjectFactory spec used to construct its ContentHandler. This array typically comes from $wgContentHandlers.
ObjectFactory$objectFactory
HookContainer$hookContainer
LoggerInterface$logger

Definition at line 76 of file ContentHandlerFactory.php.

References MediaWiki\Content\ContentHandlerFactory\$handlerSpecs, MediaWiki\Content\ContentHandlerFactory\$logger, and MediaWiki\Content\ContentHandlerFactory\$objectFactory.

Member Function Documentation

◆ createContentHandlerFromHandlerSpec()

MediaWiki\Content\ContentHandlerFactory::createContentHandlerFromHandlerSpec ( string  $modelID,
  $handlerSpec 
)
private
Parameters
string$modelID
callable | string$handlerSpec
Returns
ContentHandler
Exceptions
MWException
MWUnknownContentModelException

Definition at line 228 of file ContentHandlerFactory.php.

◆ createContentHandlerFromHook()

MediaWiki\Content\ContentHandlerFactory::createContentHandlerFromHook ( string  $modelID)
private
Parameters
string$modelID
Returns
ContentHandler
Exceptions
MWException
MWUnknownContentModelException

Definition at line 269 of file ContentHandlerFactory.php.

◆ createForModelID()

MediaWiki\Content\ContentHandlerFactory::createForModelID ( string  $modelID)
private

Create ContentHandler for ModelID.

Parameters
string$modelIDThe ID of the content model for which to get a handler. Use CONTENT_MODEL_XXX constants.
Returns
ContentHandler The ContentHandler singleton for handling the model given by the ID.
Exceptions
MWUnknownContentModelExceptionIf no handler is known for the model ID.
MWExceptionFor internal errors and problems in the configuration.

Definition at line 185 of file ContentHandlerFactory.php.

Referenced by MediaWiki\Content\ContentHandlerFactory\getContentHandler().

◆ defineContentHandler()

MediaWiki\Content\ContentHandlerFactory::defineContentHandler ( string  $modelID,
  $handlerSpec 
)

Define HandlerSpec for ModelID.

Parameters
string$modelID
callable | string$handlerSpec
Exceptions
MWException
Access: internal

Definition at line 117 of file ContentHandlerFactory.php.

◆ getAllContentFormats()

MediaWiki\Content\ContentHandlerFactory::getAllContentFormats ( )
Returns
string[]
Exceptions
MWException

Implements MediaWiki\Content\IContentHandlerFactory.

Definition at line 153 of file ContentHandlerFactory.php.

◆ getContentHandler()

MediaWiki\Content\ContentHandlerFactory::getContentHandler ( string  $modelID)
Parameters
string$modelID
Returns
ContentHandler
Exceptions
MWExceptionFor internal errors and problems in the configuration.
MWUnknownContentModelExceptionIf no handler is known for the model ID.

Implements MediaWiki\Content\IContentHandlerFactory.

Definition at line 95 of file ContentHandlerFactory.php.

References MediaWiki\Content\ContentHandlerFactory\createForModelID().

◆ getContentModels()

MediaWiki\Content\ContentHandlerFactory::getContentModels ( )

Get defined ModelIDs.

Returns
string[]
Exceptions
MWException
FatalError

Implements MediaWiki\Content\IContentHandlerFactory.

Definition at line 134 of file ContentHandlerFactory.php.

◆ isDefinedModel()

MediaWiki\Content\ContentHandlerFactory::isDefinedModel ( string  $modelID)
Parameters
string$modelID
Returns
bool
Exceptions
MWException

Implements MediaWiki\Content\IContentHandlerFactory.

Definition at line 170 of file ContentHandlerFactory.php.

◆ validateContentHandler()

MediaWiki\Content\ContentHandlerFactory::validateContentHandler ( string  $modelID,
  $contentHandler 
)
private
Parameters
string$modelID
ContentHandler$contentHandler
Exceptions
MWException
MWUnknownContentModelException

Definition at line 201 of file ContentHandlerFactory.php.

Member Data Documentation

◆ $handlersByModel

ContentHandler [] MediaWiki\Content\ContentHandlerFactory::$handlersByModel = []
private

Registry of ContentHandler instances by model id.

Definition at line 54 of file ContentHandlerFactory.php.

◆ $handlerSpecs

string [] callable [] MediaWiki\Content\ContentHandlerFactory::$handlerSpecs
private

◆ $hookRunner

HookRunner MediaWiki\Content\ContentHandlerFactory::$hookRunner
private

Definition at line 60 of file ContentHandlerFactory.php.

◆ $logger

LoggerInterface MediaWiki\Content\ContentHandlerFactory::$logger
private

◆ $objectFactory

ObjectFactory MediaWiki\Content\ContentHandlerFactory::$objectFactory
private

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