IBootContext
in
Tags
Table of Contents
Methods
- getAppContainer() : IAppContainer
- Get hold of the app's container
- getServerContainer() : IServerContainer
- Get hold of the server DI container
- injectFn() : mixed|null
- Invoke the given callable and inject all parameters based on their types and names
Methods
getAppContainer()
Get hold of the app's container
public
getAppContainer() : IAppContainer
Useful to register and query app-specific services
Tags
Return values
IAppContainergetServerContainer()
Get hold of the server DI container
public
getServerContainer() : IServerContainer
Useful to register and query system-wide services
Tags
Return values
IServerContainerinjectFn()
Invoke the given callable and inject all parameters based on their types and names
public
injectFn(callable $fn) : mixed|null
Note: when used with methods, make sure they are public or use \Closure::fromCallable to wrap the private method call, e.g.
-
$context->injectFn([$obj, 'publicMethod'])
-
$context->injectFn([$this, 'publicMethod'])
-
$context->injectFn(\Closure::fromCallable([$this, 'privateMethod']))
Note: the app container will be queried
Parameters
- $fn : callable
Tags
Return values
mixed|null —the return value of the invoked function, if any