session.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OC\Session;
  9. use OCP\ISession;
  10. abstract class Session implements \ArrayAccess, ISession {
  11. /**
  12. * @var bool
  13. */
  14. protected $sessionClosed = false;
  15. /**
  16. * $name serves as a namespace for the session keys
  17. *
  18. * @param string $name
  19. */
  20. abstract public function __construct($name);
  21. /**
  22. * @param mixed $offset
  23. * @return bool
  24. */
  25. public function offsetExists($offset) {
  26. return $this->exists($offset);
  27. }
  28. /**
  29. * @param mixed $offset
  30. * @return mixed
  31. */
  32. public function offsetGet($offset) {
  33. return $this->get($offset);
  34. }
  35. /**
  36. * @param mixed $offset
  37. * @param mixed $value
  38. */
  39. public function offsetSet($offset, $value) {
  40. $this->set($offset, $value);
  41. }
  42. /**
  43. * @param mixed $offset
  44. */
  45. public function offsetUnset($offset) {
  46. $this->remove($offset);
  47. }
  48. /**
  49. * Close the session and release the lock
  50. */
  51. public function close() {
  52. $this->sessionClosed = true;
  53. }
  54. }