/** * Returns the site URL, i.e. the URL to the directory where the front * controller is located. * * @return \Ableron\Lib\Net\Uri */ public static function getSiteUrl() { return clone CacheUtil::getFromCache(self::getCache(), __FUNCTION__, function () { return Uri::createFromComponents(self::getRequestProtocol(), self::getEnvironmentVariable('HTTP_HOST'), null, null, null, self::getSitePath())->normalize(); }); }
/** * Tests whether createFromComponents() works as expected. * * @dataProvider dataProviderTestCreateFromComponents * @return void */ public function testCreateFromComponents($scheme, $authority, $userInfo, $host, $port, $path, $query, $fragment, $expectedUri) { $this->assertSame($expectedUri, Uri::createFromComponents($scheme, $authority, $userInfo, $host, $port, $path, $query, $fragment)->toString()); }