UserFrosting API

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
author

Alex Weissman (https://alexanderweissman.com)

author

Roger Ardibee

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

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
mixed

getClassMapping()

Gets the fully qualified class name for a specified class identifier.

public getClassMapping( $identifier : string ) : string
Parameters
$identifier : string
Return values
string

setClassMapping()

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
ClassMapper

staticMethod()

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.

Return values
mixed

Search results