API reference / Quittio \ Core \ Support
Macroable
trait in quittio/core
Quittio\Core\Support\Macroable · Source
Lightweight macro support without a dependency on Laravel. Country packs use it to add helpers such as smallAmount() to the invoice builder.
Properties#
| Property | Type | Description |
|---|---|---|
$macros protected static | array<string, callable> |
Methods#
| Method | Description |
|---|---|
->__call() | |
::flushMacros() | Removes every macro registered on the class, e.g. between tests. |
::hasMacro() | Whether a macro with this name is registered on the class. |
::macro() |
__call()#
public function __call(string $method, array<mixed> $parameters): mixed| Parameter | Type | Description |
|---|---|---|
$method | string | |
$parameters | array<mixed> |
- Returns
mixed
flushMacros()#
public static function flushMacros(): voidRemoves every macro registered on the class, e.g. between tests.
hasMacro()#
public static function hasMacro(string $name): boolWhether a macro with this name is registered on the class.
| Parameter | Type | Description |
|---|---|---|
$name | string |
- Returns
bool
macro()#
public static function macro(string $name, callable $macro): void| Parameter | Type | Description |
|---|---|---|
$name | string | |
$macro | callable |