<?php

namespace Application\Service\Extension\Helper\base;

abstract class BaseUserHelper extends BaseHelper
{
    protected ?int $userId = null;

    protected function getCache(string $methodName = '')
    {
        if ($methodName) {
            return self::$cache[$this->getCacheKey()][$this->userId][$methodName] ?? false;
        }
        return self::$cache[$this->getCacheKey()][$this->userId] ?? false;
    }

    protected function setCache($value, string $methodName = '')
    {
        if ($methodName) {
            self::$cache[$this->getCacheKey()][$this->userId][$methodName] = $value;
        } else {
            self::$cache[$this->getCacheKey()][$this->userId] = $value;
        }
    }
}