/
jagepard
/
Rudra-Container
Обзор
Документация
Войти
/
jagepard
/
Rudra-Container
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Session.php
54 строки
1 KB
Jagepard
docs: translate all comments and messages to English
02 июл 2026, 17:57
02 июл 2026, 17:57
3fcb01b
Код
Авторство
О чём код?
<?php declare(strict_types=1); /** * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * * @author Korotkov Danila (Jagepard) <jagepard@yandex.ru> * @license https://mozilla.org/MPL/2.0/ MPL-2.0 */ namespace Rudra\Container; use Rudra\Exceptions\NotFoundException; class Session { public function get(string $id): mixed { return array_key_exists($id, $_SESSION) ? $_SESSION[$id] : throw new NotFoundException("Session record not found for identifier: \"$id\""); } public function set(string $key, mixed $value): void { $_SESSION[$key] = $value; } public function has(string $id): bool { return array_key_exists($id, $_SESSION); } public function remove(string $key): void { unset($_SESSION[$key]); } public function start(): void { session_start(); } public function stop(): void { session_destroy(); } public function clear(): void { $_SESSION = []; } }