<?php

namespace Korkz\Demirteknoloji\traits;

use Dotenv\Dotenv;

trait ENVConfig
{
    public static function staticEnv(): array|string
    {
        $envPath = ($_SERVER["HTTP_HOST"] === "localhost") ? "/demirteknoloji/" : "/";
        $dotenv = Dotenv::createImmutable($_SERVER["DOCUMENT_ROOT"] . $envPath);
        $dotenv->load();
        return $_ENV ?: '';
    }

    protected function env(): array|string
    {
        $envPath = ($_SERVER["HTTP_HOST"] === "localhost") ? "/demirteknoloji/" : "/";
        $dotenv = Dotenv::createImmutable($_SERVER["DOCUMENT_ROOT"] . $envPath);
        $dotenv->load();
        return $_ENV ?: '';
    }
}

