InitialState.php 841 B

123456789101112131415161718192021222324252627282930313233
  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\Services;
  8. use OCP\AppFramework\Services\IInitialState;
  9. use OCP\IInitialStateService;
  10. class InitialState implements IInitialState {
  11. /** @var IInitialStateService */
  12. private $state;
  13. /** @var string */
  14. private $appName;
  15. public function __construct(IInitialStateService $state, string $appName) {
  16. $this->state = $state;
  17. $this->appName = $appName;
  18. }
  19. public function provideInitialState(string $key, $data): void {
  20. $this->state->provideInitialState($this->appName, $key, $data);
  21. }
  22. public function provideLazyInitialState(string $key, \Closure $closure): void {
  23. $this->state->provideLazyInitialState($this->appName, $key, $closure);
  24. }
  25. }