<?php
namespace Root\Core\Helper;

class Env
{
    public static function bool(string $key, bool $default = false): bool
    {
        $value = env($key, $default);
        return filter_var($value, FILTER_VALIDATE_BOOLEAN);
    }

    public static function required(string $key): string
    {
        $val = env($key);
        if (empty($val)) {
            throw new \RuntimeException("Environment variable '$key' is missing.");
        }
        return $val;
    }
}
