<?php

namespace lib\Http;

class Cookie extends Http
{
  public function __construct()
  {
    parent::__construct();
  }
  public function get(string $key, $default = null): mixed
  {
    return $_COOKIE[$key] ?? $default;
  }

  public function set(string $key, $value, int $expire = 3600, string $path = '/'): void
  {
    setcookie($key, $value, time() + $expire, $path);
  }

  public function remove(string $key): void
  {
    setcookie($key, '', time() - 3600, '/');
  }
}
