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 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.