MediaWiki  master
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. More...
 
 getAllContentFormats ()
 
 getContentHandler (string $modelID)
 
 getContentModels ()
 Get defined ModelIDs. More...
 
 isDefinedModel (string $modelID)
 

Private Member Functions

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

Private Attributes

ContentHandler[] $handlersByModel = []
 Registry of ContentHandler instances by model id. More...
 
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 
)

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 226 of file ContentHandlerFactory.php.

References MediaWiki\Content\ContentHandlerFactory\validateContentHandler().

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

◆ createContentHandlerFromHook()

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

◆ 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 183 of file ContentHandlerFactory.php.

References MediaWiki\Content\ContentHandlerFactory\createContentHandlerFromHandlerSpec(), and MediaWiki\Content\ContentHandlerFactory\createContentHandlerFromHook().

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

Definition at line 117 of file ContentHandlerFactory.php.

◆ getAllContentFormats()

MediaWiki\Content\ContentHandlerFactory::getAllContentFormats ( )

◆ 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().

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

◆ 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.

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

◆ isDefinedModel()

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

Implements MediaWiki\Content\IContentHandlerFactory.

Definition at line 168 of file ContentHandlerFactory.php.

References MediaWiki\Content\ContentHandlerFactory\getContentModels().

◆ validateContentHandler()

MediaWiki\Content\ContentHandlerFactory::validateContentHandler ( string  $modelID,
  $contentHandler 
)
private

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: