]> source.dussan.org Git - nextcloud-server.git/commit
Callable parameter injection
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 29 Jun 2020 13:52:47 +0000 (15:52 +0200)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Fri, 3 Jul 2020 12:37:46 +0000 (14:37 +0200)
commit4a3ea04baaa67f2cbf23c3d9f776373adad375a9
tree148892dbdefd211681d03041bdfc9a35f7e86a33
parent0825530a1b1cbb98195ec15cbbd46d121bc65373
Callable parameter injection

This is like what we have to DI and classes, but for callables.

The motivating factor is to get rid of *service locators* in the `boot`
method of apps as a new pattern is about to emerge where we have lots of
`query` calls on the app or server container in order to fetch some
services.

With this little helper it's possible to call another (public) method
and magically have everything injected.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
lib/composer/composer/autoload_classmap.php
lib/composer/composer/autoload_static.php
lib/private/AppFramework/Bootstrap/BootContext.php
lib/private/AppFramework/Bootstrap/FunctionInjector.php [new file with mode: 0644]
lib/public/AppFramework/Bootstrap/IBootContext.php
tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php [new file with mode: 0644]
tests/lib/AppFramework/Utility/SimpleContainerTest.php