1
0

BootContext.php 830 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\AppFramework\Bootstrap;
  8. use OCP\AppFramework\Bootstrap\IBootContext;
  9. use OCP\AppFramework\IAppContainer;
  10. use OCP\IServerContainer;
  11. class BootContext implements IBootContext {
  12. /** @var IAppContainer */
  13. private $appContainer;
  14. public function __construct(IAppContainer $appContainer) {
  15. $this->appContainer = $appContainer;
  16. }
  17. public function getAppContainer(): IAppContainer {
  18. return $this->appContainer;
  19. }
  20. public function getServerContainer(): IServerContainer {
  21. return $this->appContainer->get(IServerContainer::class);
  22. }
  23. public function injectFn(callable $fn) {
  24. return (new FunctionInjector($this->appContainer))->injectFn($fn);
  25. }
  26. }