aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Session/Memory.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Session/Memory.php')
-rw-r--r--lib/private/Session/Memory.php51
1 files changed, 6 insertions, 45 deletions
diff --git a/lib/private/Session/Memory.php b/lib/private/Session/Memory.php
index 0afd3703366..395711836f5 100644
--- a/lib/private/Session/Memory.php
+++ b/lib/private/Session/Memory.php
@@ -1,36 +1,13 @@
<?php
declare(strict_types=1);
-
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Session;
-use Exception;
use OCP\Session\Exceptions\SessionNotAvailableException;
/**
@@ -43,17 +20,11 @@ use OCP\Session\Exceptions\SessionNotAvailableException;
class Memory extends Session {
protected $data;
- public function __construct(string $name) {
- //no need to use $name since all data is already scoped to this instance
- $this->data = [];
- }
-
/**
* @param string $key
* @param integer $value
*/
public function set(string $key, $value) {
- $this->validateSession();
$this->data[$key] = $value;
}
@@ -80,7 +51,6 @@ class Memory extends Session {
* @param string $key
*/
public function remove(string $key) {
- $this->validateSession();
unset($this->data[$key]);
}
@@ -110,18 +80,9 @@ class Memory extends Session {
/**
* Helper function for PHPUnit execution - don't use in non-test code
*/
- public function reopen() {
+ public function reopen(): bool {
+ $reopened = $this->sessionClosed;
$this->sessionClosed = false;
- }
-
- /**
- * In case the session has already been locked an exception will be thrown
- *
- * @throws Exception
- */
- private function validateSession() {
- if ($this->sessionClosed) {
- throw new Exception('Session has been closed - no further changes to the session are allowed');
- }
+ return $reopened;
}
}