Mixin
Trait Mixin.
Allows mixing in entire classes with multiple macros.
Table of Contents
Properties
- $macroContextStack : array<string|int, mixed>
- Stack of macro instance contexts.
Methods
- mixin() : void
- Mix another object into the class.
- bindMacroContext() : mixed
- Stack a Carbon context from inside calls of self::this() and execute a given action.
- context() : static|null
- Return the current context from inside a macro callee or a null if static.
- this() : static
- Return the current context from inside a macro callee or a new one if static.
- getAnonymousClassCodeForTrait() : string
- getMixableMethods() : Generator
- loadMixinClass() : void
- loadMixinTrait() : void
Properties
$macroContextStack
Stack of macro instance contexts.
protected
static array<string|int, mixed>
$macroContextStack
= []
Methods
mixin()
Mix another object into the class.
public
static mixin(object|string $mixin) : void
Parameters
- $mixin : object|string
Tags
bindMacroContext()
Stack a Carbon context from inside calls of self::this() and execute a given action.
protected
static bindMacroContext(self|null $context, callable $callable) : mixed
Parameters
- $context : self|null
- $callable : callable
context()
Return the current context from inside a macro callee or a null if static.
protected
static context() : static|null
Return values
static|nullthis()
Return the current context from inside a macro callee or a new one if static.
protected
static this() : static
Return values
staticgetAnonymousClassCodeForTrait()
private
static getAnonymousClassCodeForTrait(string $trait) : string
Parameters
- $trait : string
Return values
stringgetMixableMethods()
private
static getMixableMethods(self $context) : Generator
Parameters
- $context : self
Return values
GeneratorloadMixinClass()
private
static loadMixinClass(object|string $mixin) : void
Parameters
- $mixin : object|string
Tags
loadMixinTrait()
private
static loadMixinTrait(string $trait) : void
Parameters
- $trait : string