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 = []

Methods

registerRendererClass()

Allows to register a Renderer class

public registerRendererClass(string $className) : mixed
Parameters
$className : string
Tags
throws
InvalidArgumentException

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


        
On this page

Search results