<?php

declare(strict_types=1);

namespace Plugin\tnt_stabila_shop\src\Abstracts;

use JTL\Plugin\PluginInterface;

/**
 * Class AbstractSessionRepository
 *
 * @package Plugin\tnt_stabila_shop\src\Abstracts
 */
abstract class AbstractSessionRepository
{
    public function __construct(public string $pluginID)
    {
    }

    protected function set(string $name, mixed $value): void
    {
        $_SESSION[$this->pluginID . '_' . $name] = $value;
    }

    protected function get(string $name): mixed
    {
        return $_SESSION[$this->pluginID . '_' . $name] ?? null;
    }

    protected function unset(string $name): void
    {
        unset($_SESSION[$this->pluginID . '_' . $name]);
    }
}
