<?php
/*
 * Software Name: Eorisis Setup
 * Software URI: https://eorisis.com/shop/software/joomla/setup
 * Author: Eorisis
 * Author URI: https://eorisis.com
 * Copyright: Copyright (C) 2011-2025 EORISIS. All Rights Reserved.
 * License: GNU General Public License version 2; See https://eorisis.com/gpl
 * Terms of Service: https://eorisis.com/tos
 */
namespace eorisis_setup\framework\lib\core\cms;
\defined('_JEXEC') or die;

use EorisisUri, JLoader;

if (\version_compare(JVERSION, '3.8', '>='))
{
	JLoader::registerAlias('EorisisUri', '\\Joomla\\CMS\\Uri\\Uri');
}
else
{
	JLoader::registerAlias('EorisisUri', 'JUri');
}

class uri
{
	public function __construct() {}

	// --------------------------------------------------

	public static function webroot_relative() : string
	{
		static $val = null;
		if ($val === null)
		{
			$val = \rtrim(self::root(true), '/').'/';
		}

		return $val;
	}

	// --------------------------------------------------

	private static function root(bool $pathonly = false, $path = null)
	{
		return EorisisUri::root($pathonly, $path);
	}
}
