Macroable
trait Macroable
Properties
| static protected array | $macros | The registered string macros. |
Methods
Register a custom macro.
Mix another object into the class.
Check if macro is registered.
Flush the existing macros.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Details
at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.