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)
 
 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 = []
 
ObjectFactory $objectFactory
 

Detailed Description

Definition at line 42 of file ContentHandlerFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Content\ContentHandlerFactory::__construct ( array  $handlerSpecs,
ObjectFactory  $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 210 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 167 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 101 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 80 of file ContentHandlerFactory.php.

References MediaWiki\Content\ContentHandlerFactory\createForModelID(), and wfDebugLog().

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

References Hooks\run().

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

◆ $handlerSpecs

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

◆ $objectFactory

ObjectFactory MediaWiki\Content\ContentHandlerFactory::$objectFactory
private

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