Nextcloud PHP API (master)

IBootContext

Tags
since
20.0.0

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
since
20.0.0
Return values
IAppContainer

injectFn()

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
throws
ContainerExceptionInterface

if at least one of the parameter can't be resolved

throws
Throwable

any error the function invocation might cause

since
20.0.0
Return values
mixed|null

the return value of the invoked function, if any


        
On this page

Search results