HasAliasesTrait
trait HasAliasesTrait (View source)
Add methods to classes at runtime.
Loosely based on spatie/macroable.
Methods
boolean
hasAlias(string $alias)
Get whether an alias is registered.
array|null
getAlias(string $alias)
Get a registered alias.
void
setAlias(array $alias)
Register an alias.
mixed
__call(string $method, array $parameters)
Call alias if registered.
mixed|null
resolve(string $key)
Resolve a dependency from the IoC container.
Details
at line 36
boolean
hasAlias(string $alias)
Get whether an alias is registered.
at line 46
array|null
getAlias(string $alias)
Get a registered alias.
at line 62
void
setAlias(array $alias)
Register an alias.
Useful when passed the return value of getAlias() to restore a previously registered alias, for example.
at line 82
void
alias(string $alias, string|Closure $target, string $method = '')
Register an alias.
Identical to setAlias but with a more user-friendly interface.
at line 97
mixed
__call(string $method, array $parameters)
Call alias if registered.
at line 123
abstract mixed|null
resolve(string $key)
Resolve a dependency from the IoC container.