1
0

IInitialStateService.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP;
  8. use Closure;
  9. /**
  10. * @since 16.0.0
  11. * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider
  12. * @see \OCP\AppFramework\Services\IInitialState
  13. */
  14. interface IInitialStateService {
  15. /**
  16. * Allows an app to provide its initial state to the template system.
  17. * Use this if you know your initial state sill be used for example if
  18. * you are in the render function of you controller.
  19. *
  20. * @since 16.0.0
  21. *
  22. * @param string $appName
  23. * @param string $key
  24. * @param bool|int|float|string|array|\JsonSerializable $data
  25. *
  26. * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider
  27. * @see \OCP\AppFramework\Services\IInitialState::provideInitialState()
  28. */
  29. public function provideInitialState(string $appName, string $key, $data): void;
  30. /**
  31. * Allows an app to provide its initial state via a lazy method.
  32. * This will call the closure when the template is being generated.
  33. * Use this if your app is injected into pages. Since then the render method
  34. * is not called explicitly. But we do not want to load the state on webdav
  35. * requests for example.
  36. *
  37. * @since 16.0.0
  38. *
  39. * @param string $appName
  40. * @param string $key
  41. * @param Closure $closure returns a primitive or an object that implements JsonSerializable
  42. *
  43. * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider
  44. * @see \OCP\AppFramework\Services\IInitialState::provideLazyInitialState()
  45. */
  46. public function provideLazyInitialState(string $appName, string $key, Closure $closure): void;
  47. }