/**
* Returns the root URI for the request.
*
* @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false.
* @param string $path The path
*
* @return string The root URI string.
*
* @since 1.7.0
*/
public static function root($pathonly = false, $path = null)
{
// Get the scheme
if (empty(static::$root)) {
$uri = static::getInstance(static::base());
static::$root['prefix'] = $uri->toString(array('scheme', 'host', 'port'));
static::$root['path'] = rtrim($uri->toString(array('path')), '/\\');
}
// Get the scheme
if (isset($path)) {
static::$root['path'] = $path;
}
return $pathonly === false ? static::$root['prefix'] . static::$root['path'] . '/' : static::$root['path'];
}