<?php

// Request Url
function currentURL(): string
{
    $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
    $host = $_SERVER['HTTP_HOST'] ?? 'localhost';
    $query = $_SERVER['REQUEST_URI'] ?? null;
    return sprintf("%s://%s%s", $protocol, $host, $query);
}

/*
 * 단말기 구분으로 레이아웃 처리
 */
function layout(string $viewPath): string
{
    return (DEVICE_TYPE != DEVICE_TYPE_1 ? ('mobile.' . $viewPath) : $viewPath);
}
