ClassMapper
UserFrosting class mapper.
This creates an abstraction layer for overrideable classes. For example, if we want to replace usages of the User class with MyUser, this abstraction layer handles that.
Tags
Table of Contents
$classMappings | array | |
---|---|---|
createInstance() | Creates an instance for a requested class identifier. | mixed |
getClassMapping() | Gets the fully qualified class name for a specified class identifier. | string |
setClassMapping() | Assigns a fully qualified class name to a specified class identifier. | ClassMapper |
staticMethod() | Call a static method for a specified class. | mixed |
Properties
$classMappings
protected
array
$classMappings
= []
Methods
createInstance()
Creates an instance for a requested class identifier.
public
createInstance(
$identifier :
string
)
: mixed
Parameters
- $identifier : string
The identifier for the class, e.g. 'user'
Return values
mixedgetClassMapping()
Gets the fully qualified class name for a specified class identifier.
public
getClassMapping(
$identifier :
string
)
: string
Parameters
- $identifier : string
Return values
stringsetClassMapping()
Assigns a fully qualified class name to a specified class identifier.
public
setClassMapping(
$identifier :
string
, $className :
string
)
: ClassMapper
Parameters
- $identifier : string
- $className : string
Return values
ClassMapperstaticMethod()
Call a static method for a specified class.
public
staticMethod(
$identifier :
string
, $methodName :
string
)
: mixed
Parameters
- $identifier : string
The identifier for the class, e.g. 'user'
- $methodName : string
The method to be invoked.