Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\ServiceByTypeDispatcher Class Reference

Public Member Functions

 __construct (string $type, array $callbacks, object $defaultService)
 
 getServiceForType (string $entityType, array $callbackArgs=[])
 

Private Member Functions

 createService (string $entityType, array $args=[])
 

Private Attributes

 $callbacks
 
 $services
 
 $defaultService
 
 $type
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\ServiceByTypeDispatcher::__construct ( string $type,
array $callbacks,
object $defaultService )
Parameters
class-string$typetype of the dispatched services, i.e. type of the default service and the return value of the callbacks
callable[]$callbacksmap of entity types to callbacks creating the service to be used
object$defaultServicethe service to be used when there is no callback defined for the given entity type

Member Function Documentation

◆ createService()

Wikibase\Lib\ServiceByTypeDispatcher::createService ( string $entityType,
array $args = [] )
private

◆ getServiceForType()

Wikibase\Lib\ServiceByTypeDispatcher::getServiceForType ( string $entityType,
array $callbackArgs = [] )
Parameters
string$entityType
array$callbackArgsarguments to be passed to the service creation callback
Returns
object

Member Data Documentation

◆ $callbacks

Wikibase\Lib\ServiceByTypeDispatcher::$callbacks
private

◆ $defaultService

Wikibase\Lib\ServiceByTypeDispatcher::$defaultService
private

◆ $services

Wikibase\Lib\ServiceByTypeDispatcher::$services
private

◆ $type

Wikibase\Lib\ServiceByTypeDispatcher::$type
private

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