<?php

namespace lib\Core\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 = APP_SESSION_COOKIE_EXPIRE, string $path = APP_SESSION_COOKIE_PATH): void
  {
    setcookie($key, $value, time() + $expire, $path);
  }

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