IBootContext

interface OCP\AppFramework\Bootstrap\IBootContext
Implemented by:OC\AppFramework\Bootstrap\BootContext
Source:lib/public/AppFramework/Bootstrap/IBootContext.php#38

Methods

public OCP\AppFramework\Bootstrap\IBootContext::getAppContainer()
Get hold of the app’s container
Useful to register and query app-specific services
Source:lib/public/AppFramework/Bootstrap/IBootContext.php#48
Returns:\OCP\AppFramework\IAppContainer
Since:20.0.0
public OCP\AppFramework\Bootstrap\IBootContext::getServerContainer()
Get hold of the server DI container
Useful to register and query system-wide services
Source:lib/public/AppFramework/Bootstrap/IBootContext.php#58
Returns:\OCP\IServerContainer
Since:20.0.0
public OCP\AppFramework\Bootstrap\IBootContext::injectFn($fn)
Invoke the given callable and inject all parameters based on their types
and names
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
Source:

lib/public/AppFramework/Bootstrap/IBootContext.php#78

Parameters:
  • $fn (callable)
Throws:

\Psr\Container\ContainerExceptionInterface if at least one of the parameter can’t be resolved

Throws:

\Throwable any error the function invocation might cause

Throws:

\Psr\Container\ContainerExceptionInterface if at least one of the parameter can’t be resolved

Throws:

\Throwable any error the function invocation might cause

Returns:

mixed | null the return value of the invoked function, if any

Since:

20.0.0