You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Session.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OC\Session;
  25. use OCP\ISession;
  26. abstract class Session implements \ArrayAccess, ISession {
  27. /**
  28. * @var bool
  29. */
  30. protected $sessionClosed = false;
  31. /**
  32. * $name serves as a namespace for the session keys
  33. *
  34. * @param string $name
  35. */
  36. abstract public function __construct($name);
  37. /**
  38. * @param mixed $offset
  39. * @return bool
  40. */
  41. public function offsetExists($offset) {
  42. return $this->exists($offset);
  43. }
  44. /**
  45. * @param mixed $offset
  46. * @return mixed
  47. */
  48. public function offsetGet($offset) {
  49. return $this->get($offset);
  50. }
  51. /**
  52. * @param mixed $offset
  53. * @param mixed $value
  54. */
  55. public function offsetSet($offset, $value) {
  56. $this->set($offset, $value);
  57. }
  58. /**
  59. * @param mixed $offset
  60. */
  61. public function offsetUnset($offset) {
  62. $this->remove($offset);
  63. }
  64. /**
  65. * Close the session and release the lock
  66. */
  67. public function close() {
  68. $this->sessionClosed = true;
  69. }
  70. }