1
0

Session.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OC\Session;
  9. use OCP\ISession;
  10. /**
  11. * @template-implements \ArrayAccess<string,mixed>
  12. */
  13. abstract class Session implements \ArrayAccess, ISession {
  14. /**
  15. * @var bool
  16. */
  17. protected $sessionClosed = false;
  18. /**
  19. * @param mixed $offset
  20. * @return bool
  21. */
  22. public function offsetExists($offset): bool {
  23. return $this->exists($offset);
  24. }
  25. /**
  26. * @param mixed $offset
  27. * @return mixed
  28. */
  29. #[\ReturnTypeWillChange]
  30. public function offsetGet($offset) {
  31. return $this->get($offset);
  32. }
  33. /**
  34. * @param mixed $offset
  35. * @param mixed $value
  36. */
  37. public function offsetSet($offset, $value): void {
  38. $this->set($offset, $value);
  39. }
  40. /**
  41. * @param mixed $offset
  42. */
  43. public function offsetUnset($offset): void {
  44. $this->remove($offset);
  45. }
  46. /**
  47. * Close the session and release the lock
  48. */
  49. public function close() {
  50. $this->sessionClosed = true;
  51. }
  52. }