ReactionContextsManager
extends Instanceable
in package
Manages registering and retrieving reaction contexts.
Tags
Table of Contents
Properties
- $_contexts : array<string|int, ReactionContext>
- $_instances : array<class-string, static>
- Stores instances of classes with their class name as key.
Methods
- getContext() : ReactionContext|null
- Get a reaction context by name.
- getContexts() : array<string|int, ReactionContext>
- Get all registered reaction contexts.
- getInstance() : static
- Get or make an instance of the class this was called on.
- provideContext() : void
- Register a new reaction context.
- validContextFriendlyNames() : array<string|int, string>
- Get all valid reaction context friendly names.
- validContextNames() : array<string|int, string>
- Get all valid reaction context names.
- enabledContexts() : array<string|int, ReactionContext>
- Get all enabled reaction contexts.
Properties
$_contexts
private
array<string|int, ReactionContext>
$_contexts
= []
$_instances
Stores instances of classes with their class name as key.
private
static array<class-string, static>
$_instances
= []
Methods
getContext()
Get a reaction context by name.
public
getContext(string $name) : ReactionContext|null
Parameters
- $name : string
-
Name of reaction context to get.
Return values
ReactionContext|null —Reaction context with the given name, or throws error if it does not exist.
getContexts()
Get all registered reaction contexts.
public
getContexts() : array<string|int, ReactionContext>
Return values
array<string|int, ReactionContext> —All registered reaction contexts.
getInstance()
Get or make an instance of the class this was called on.
public
final static getInstance() : static
Return values
static —Instance of the class this was called on.
provideContext()
Register a new reaction context.
public
provideContext(ReactionContext $context) : void
Parameters
- $context : ReactionContext
-
Reaction context to register.
validContextFriendlyNames()
Get all valid reaction context friendly names.
public
validContextFriendlyNames(Language $language) : array<string|int, string>
Parameters
- $language : Language
-
Language to translate friendly names in.
Return values
array<string|int, string> —All valid reaction context friendly names.
validContextNames()
Get all valid reaction context names.
public
validContextNames() : array<string|int, string>
Return values
array<string|int, string> —All valid reaction context names.
enabledContexts()
Get all enabled reaction contexts.
private
enabledContexts() : array<string|int, ReactionContext>
Return values
array<string|int, ReactionContext> —All enabled reaction contexts.