trait Macro
Trait Macros.
Allows users to register macros within the Carbon class.
Traits
Properties
staticprotectedarray | $macroContextStack | Stack of macro instance contexts. | from Mixin |
staticprotectedarray | $globalMacros | The registered macros. | |
staticprotectedarray | $globalGenericMacros | The registered generic macros. |
Methods
Stack a Carbon context from inside calls of self::this() and execute a given action.
Return the current context from inside a macro callee or a null if static.
Return the current context from inside a macro callee or a new one if static.
Register a custom macro.
Remove all macros and generic macros.
Register a custom macro.
Checks if macro is registered globally.
Get the raw callable macro registered globally for a given name.
Checks if macro is registered globally or locally.
Get the raw callable macro registered globally or locally for a given name.
Details
inMixinat line66
staticvoid
mixin(object|string$mixin)
Mix another object into the class.
inMixinat line151
staticprotectedmixed
bindMacroContext(Mixin|null$context,callable$callable)
Stack a Carbon context from inside calls of self::this() and execute a given action.
inMixinat line177
staticprotectedMixin|null
context()
Return the current context from inside a macro callee or a null if static.
inMixinat line187
staticprotectedMixin
this()
Return the current context from inside a macro callee or a new one if static.
at line57
staticvoid
macro(string$name,object|callable$macro)
Register a custom macro.
at line65
static
resetMacros()
Remove all macros and generic macros.
at line79
staticvoid
genericMacro(object|callable$macro,int$priority =0)
Register a custom macro.
at line96
staticbool
hasMacro(string$name)
Checks if macro is registered globally.
at line108
staticcallable|null
getMacro(string$name)
Get the raw callable macro registered globally for a given name.
at line120
bool
hasLocalMacro(string$name)
Checks if macro is registered globally or locally.
at line132
callable|null
getLocalMacro(string$name)
Get the raw callable macro registered globally or locally for a given name.