2013-05-27 18:50:00 -04:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-02-26 16:20:21 -05:00
|
|
|
declare(strict_types=1);
|
2013-05-27 18:50:00 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2013-05-27 18:50:00 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\Session;
|
|
|
|
|
|
2013-10-08 15:52:54 -04:00
|
|
|
use OCP\ISession;
|
|
|
|
|
|
2024-02-05 12:08:26 -05:00
|
|
|
/**
|
|
|
|
|
* @template-implements \ArrayAccess<string,mixed>
|
|
|
|
|
*/
|
2013-10-08 15:52:54 -04:00
|
|
|
abstract class Session implements \ArrayAccess, ISession {
|
2014-03-10 12:15:19 -04:00
|
|
|
/**
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $sessionClosed = false;
|
|
|
|
|
|
2013-05-28 10:52:40 -04:00
|
|
|
/**
|
|
|
|
|
* @param mixed $offset
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2018-02-26 16:20:21 -05:00
|
|
|
public function offsetExists($offset): bool {
|
2013-05-28 10:52:40 -04:00
|
|
|
return $this->exists($offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mixed $offset
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
2021-10-19 11:11:53 -04:00
|
|
|
#[\ReturnTypeWillChange]
|
2013-05-28 10:52:40 -04:00
|
|
|
public function offsetGet($offset) {
|
|
|
|
|
return $this->get($offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mixed $offset
|
|
|
|
|
* @param mixed $value
|
|
|
|
|
*/
|
2021-10-19 11:11:53 -04:00
|
|
|
public function offsetSet($offset, $value): void {
|
2013-05-28 10:52:40 -04:00
|
|
|
$this->set($offset, $value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mixed $offset
|
|
|
|
|
*/
|
2021-10-19 11:11:53 -04:00
|
|
|
public function offsetUnset($offset): void {
|
2013-05-28 10:52:40 -04:00
|
|
|
$this->remove($offset);
|
|
|
|
|
}
|
2014-03-10 09:21:12 -04:00
|
|
|
|
2014-03-10 12:15:19 -04:00
|
|
|
/**
|
|
|
|
|
* Close the session and release the lock
|
|
|
|
|
*/
|
2014-03-10 09:21:12 -04:00
|
|
|
public function close() {
|
|
|
|
|
$this->sessionClosed = true;
|
|
|
|
|
}
|
2013-05-27 18:50:00 -04:00
|
|
|
}
|