(int) $time, 'path' => '/', 'secure' => $secure, 'httponly' => true, 'samesite' => self::sameSite($secure), ]; if (trim((string) $domain) !== '') { $options['domain'] = trim((string) $domain); } return $options; } public static function set($arg, $time) { foreach ($arg as $key => $value) { setcookie($key, $value === null ? '' : (string) $value, self::options($time)); } } public static function setwithdomain($arg, $time, $domain) { foreach ($arg as $key => $value) { setcookie($key, $value === null ? '' : (string) $value, self::options($time, $domain)); } } public static function startSession() { if (session_status() !== PHP_SESSION_NONE) { return; } $secure = self::isSecureRequest(); session_set_cookie_params([ 'lifetime' => 0, 'path' => '/', 'secure' => $secure, 'httponly' => true, 'samesite' => self::sameSite($secure), ]); session_start(); } public static function get($key) { if (isset($_COOKIE[$key])) { return $_COOKIE[$key]; } return ""; } }