RendererRegistry implements SingletonInterface
Class RendererRegistry
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $classNames : array<string|int, mixed>
- Registered class names
- $instances : array<string|int, FileRendererInterface>
- Instance cache for renderer classes
Methods
- getRenderer() : FileRendererInterface|null
- Get matching renderer with highest priority
- getRendererInstances() : array<string|int, FileRendererInterface>
- Get all registered renderer instances
- registerRendererClass() : mixed
- Allows to register a Renderer class
- compareRendererPriority() : int
- Compare the priority of two renderer classes Is used for sorting array of Renderer instances by priority We want the result to be ordered from high to low so a higher priority comes before a lower.
- createRendererInstance() : FileRendererInterface
- Create an instance of a certain renderer class
Properties
$classNames
Registered class names
protected
array<string|int, mixed>
$classNames
= []
$instances
Instance cache for renderer classes
protected
array<string|int, FileRendererInterface>
$instances
Methods
getRenderer()
Get matching renderer with highest priority
public
getRenderer(FileInterface $file) : FileRendererInterface|null
Parameters
- $file : FileInterface
Return values
FileRendererInterface|nullgetRendererInstances()
Get all registered renderer instances
public
getRendererInstances() : array<string|int, FileRendererInterface>
Return values
array<string|int, FileRendererInterface>registerRendererClass()
Allows to register a Renderer class
public
registerRendererClass(string $className) : mixed
Parameters
- $className : string
Tags
compareRendererPriority()
Compare the priority of two renderer classes Is used for sorting array of Renderer instances by priority We want the result to be ordered from high to low so a higher priority comes before a lower.
protected
compareRendererPriority(FileRendererInterface $rendererA, FileRendererInterface $rendererB) : int
Parameters
- $rendererA : FileRendererInterface
- $rendererB : FileRendererInterface
Return values
int —-1 a > b, 0 a == b, 1 a < b
createRendererInstance()
Create an instance of a certain renderer class
protected
createRendererInstance(string $className) : FileRendererInterface
Parameters
- $className : string