/** * Test the setScheme method. * * @return void * * @since 1.0 * @covers Joomla\Uri\Uri::setScheme */ public function testSetScheme() { $this->object->setScheme('ftp'); $this->assertThat($this->object->getScheme(), $this->equalTo('ftp')); }
/** * Give a relative path, return path with host. * * @param string $path A system path. * * @return string Path with host added. */ public static function pathAddHost($path) { if (!$path) { return ''; } // Build path $uri = new Uri($path); if ($uri->getHost()) { return $path; } $uri = new Uri(\JUri::root()); $root_path = $uri->getPath(); if (strpos($path, $root_path) === 0) { $num = Utf8String::strlen($root_path); $path = Utf8String::substr($path, $num); } $uri->setPath($uri->getPath() . $path); $uri->setScheme('http'); $uri->setQuery(null); return $uri->toString(); }